Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Because you use <code>loadonce:true</code>, then you prepare the data on the server. On the server side you can decide which row must be selected. On the server side you can also easy calculate on which page will be the selected row. The id of selected row and the selected page you can for example include as a part of the <a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:retrieving_data#user_data" rel="nofollow noreferrer">userdata</a>. So the data sent from the server could looks like following:</p> <pre class="lang-json prettyprint-override"><code>{ "total": 5, "page": 1, "records": 107, "rows": [ ... ], "userdata": { "page": 3, "selId": 24 } } </code></pre> <p>Inside of <code>loadComplete</code> you can do about following</p> <pre class="lang-js prettyprint-override"><code>loadComplete: function(data) { if (jQuery("#list").getGridParam('datatype') === "json") { // data.userdata is the same as jQuery("#list").getGridParam('userData'); var userdata = jQuery("#list").getGridParam('userData'); var curPage = jQuery("#list").getGridParam('page'); // is always 1 if (curPage !== userdata.page) { setTimeout(function(){ jQuery("#list").setGridParam( { page: userdata.page }).trigger("reloadGrid"); jQuery("#list").setSelection (userdata.selId, true); },100); } else { jQuery("#list").setSelection (userdata.selId, true); } } } </code></pre> <p>A working examples you can see on <a href="http://www.ok-soft-gmbh.com/jqGrid/DataToSelect.htm" rel="nofollow noreferrer">http://www.ok-soft-gmbh.com/jqGrid/DataToSelect.htm</a> and <a href="http://www.ok-soft-gmbh.com/jqGrid/DataToMultiSelect.htm" rel="nofollow noreferrer">http://www.ok-soft-gmbh.com/jqGrid/DataToMultiSelect.htm</a>.</p> <p><strong>UPDATE</strong>: <a href="https://github.com/free-jqgrid/jqGrid" rel="nofollow noreferrer">Free jqGrid</a> supports <code>multiPageSelection:true</code> option strarting with the version 4.10.0. The option allows to set selection of multiple rows in the grid very easy (and it works very quickly, because it set selection state directly <em>during creating the body</em> of the grid). See <a href="https://stackoverflow.com/a/33021115/315935">the answer</a> and <a href="http://www.ok-soft-gmbh.com/jqGrid/OK/multiPageSelection.htm" rel="nofollow noreferrer">the demo</a> and <a href="https://github.com/free-jqgrid/jqGrid/blob/v4.10.0/README.md#main-new-features-and-improvements-implemented-in-the-version-4100" rel="nofollow noreferrer">the readme to 4.10.0</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload