Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6321883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:13:45+00:00 2026-05-24T16:13:45+00:00

As an extension to my previous question , I would like to automatically select

  • 0

As an extension to my previous question, I would like to automatically select rows by default. In this response, they use loadComplete to select rows after server request. However, I request from the server once and use local data from then on. I need instead to reselect rows every time the columns are organized, the grid is searched…basically every time the view of the data changes.

I select rows based on a column (book_id) rather than an explicit rowid, so would the answer here be appropriate? Or does jqGrid have an explicit method (onUpdateGrid, e.g.) to help achieve this goal? It looks for now that I would just have to replicate code under both onPaging and onSortCol.

The dataInit method for the fav_books column:

initBookEdit: function(elem){
  //populate reference table
  populateBookRefs($(elem).val());

  //display dialog which contains reference table
  //pressing OK button on dialog saves all id's as a
  //comma delimited list in the main table
  $('#bookRefPopup').dialog({
     buttons: {
    "OK": function(){
        var selectedRows = bookRefTable.jqGrid('getGridParam', 'selarrrow');
        var selectedIds = new Array();
        for(var i=0; i<selectedRows.length; i++){
            var changedRow = bookRefTable.getRowData(selectedRows[i]);
            var book_id = changedRow['book_id'];
            selectedIds.push(book_id);
        }
        var editedRow = $('#mainTable').jqGrid('getGridParam', 'selrow');
        $('#mainTable').jqGrid('setCell',editedRow, 'docs_ref', selectedIds, null, null, true);
        $('#mainTable').trigger('reloadGrid');
        $(this).dialog( "close" );
    },
    Cancel: function() {
        $( this ).dialog( "close" );
    }
}//close buttons
  });//close dialog
}

And the initialization of the reference table:

function populateBookRefs(ids){
  values = ids.split(',');
  grid.jqGrid({
     ...
     loadComplete:  function(){ //event executed after server request
        for(var i=0; i<values.length; i++){
          grid.jqGrid('setSelection',values[i],true);
        }

    }
     ...
  });
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T16:13:45+00:00Added an answer on May 24, 2026 at 4:13 pm

    it looks like gridComplete will do what i want:

    gridComplete: function(){   
        var grid_ids=grid.jqGrid('getDataIDs');
        for(var i=0; i<grid_ids.length; i++){
            var rowid = grid_ids[i];
            var aRow = grid.jqGrid('getRowData',rowid);
            var book_id = aRow['book_id'];
            if($.inArray(book_id,values)!=-1){
                grid.jqGrid('setSelection',rowid,true);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this question is an extension to a previous question i asked (and was answered).
(Note: This is an extension of a previous question .) I am having some
This is an extension of my previous question, Application crash with no explanation .
This is related to my previous question , regarding pulling objects from a dmp
I develop an extension module for Guile, written in C. This extension module embeds
I have a C extension module and it would be nice to distribute built
I typically use extension methods very sparingly. When I do feel compelled to write
Thanks to the people who answered my question this morning: SQL Server 2008: Count
This is a follow-up to an earlier question I posted on EF4 entity keys
As I understand it when I use LINQ extension methods (with lambda expression syntax)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.