Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jqGrid keep current page on refresh

Tags:

jqgrid

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.

like image 674
jtaylor___ Avatar asked Nov 01 '22 04:11

jtaylor___


1 Answers

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.

like image 182
Pat Dobson Avatar answered Nov 08 '22 06:11

Pat Dobson