JqGrid: how to use multiselect on different pages

A simple question, it is difficult to find the answer:

If I try to select a line programmatically, I use this:

$('#grid').jqGrid('setSelection', rowId); 

The problem is that it only selects rows on the current visible page. If rowId is on another page, it will not be selected.

Additional information: My task is to select several lines (scattered across several pages) when loading the page for the first time.

Thanks Raphael

PS: This guy has the same problem. There is no answer yet: jqgrid multiselect only selects rows on the current page if paging is enabled. How to make it select rows by pages?

+7
source share
2 answers

To the right, jqGrid will only select rows on the current page. To select other lines, you need to save the list of the selected identifier and manually select them.

To do this, you need to add code to your loadComplete event to find the current page and select any of these lines:

 var ids = grid.jqGrid('getDataIDs'); for (var i = 0; i < ids.length; i++){ if (selected[ids[i]] === true ){ grid.setSelection(ids[i], false); } } 

You also need to add code to the onSelectRow and onSelectAll in order to configure the selected content when the user selects / deselects rows:

 onSelectRow: function(rowid, status){ selected[rowid] = status; setSelectedDeviceCount(); }, onSelectAll: function(rowids, status){ for (var i = 0; i < rowids.length; i++){ selected[rowids[i]] = status; } } 

Does it help?

+8
source

Please see the following: http : //stackoverflow.com

To achieve the desired result.

0
source

All Articles