I'm trying to get a jqGrid table to keep its current page on a reload. I've found some samples, but they don't seem to work for me. Here's what I'm trying:
grid.setGridParam({datatype:'json'}).trigger('reloadGrid',[{page:currentPage}]);
It refreshes but always redisplays the first page.
To retain the page on a redraw simply use this:
grid.trigger("reloadGrid",[{current:true}]);
As a matter of interest, you can also get the current page using:
var currentPageVar = grid.getGridParam('page');
Addition:
'grid' is defined thus:
var grid = jQuery("#grid");
Which refers to the ID of the grid table in the HTML.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With