Reputation: 45
I am using jqGrid in my application and I have to select the currently selected row index. I am using this code.
var selectedrow = $('#s_1_l').jqGrid('getGridParam','selrow');
But I found out from this http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options site that if I use paging it will set to null. Is there any way I can get the selected row if I am using paging in jqGrid?
Thanks.
Upvotes: 0
Views: 2873
Reputation: 221997
jqGrid support selrow
only for the current page. There are no support of any kind of persistence of selected row.
There are many ways (which are not always simple) to implement different scenarios of persistent selection.
For example the answer and this one one demonstrate how one can implement saving selected rows independent from the paging.
The demo which I created for the answer shows how to persist the current page and the selected row. Just try to select a row then change the page and go to the original page back. You will see that the selected row stay selected. The demo saves selected row, the current page number and some other states in the localStorage
of the web browser. So if you even reload the page (with F5) or close the web browser and open it one more time on the same page you will see the same row selected and the same page chosen.
I hope that above demos and the corresponding answers with descriptions will help you to solve your problem.
Upvotes: 1