ffffff01
ffffff01

Reputation: 5238

Set start page of jqgrid when loadonce: true

Is it possible to set another page than page one as start page when I'm using loadonce: true in jqgrid?

Right now I perform a reloadgrid after the first load, and I dont think thats really good performance wice..

Upvotes: 0

Views: 2193

Answers (2)

Oleg
Oleg

Reputation: 221997

I think that you have to call reloadGrid somewhere inside of loadComplete. You should do this only once at the loading from the server (see here, but use [{page: thePageNumber}] as the second parameter of reloadGrid).

The only optimization which I would recommend you is the usage of very low value of rowNum (for example 1) at the initialization. Before call of reloadGrid you can increase the rowNum to the value which you really want to see the user (25 for example). To reduce the flicker you can hide the <table> inside of hidden <div> and show it inside of loadComplete in case of $(this).getGridParam('datatype') === 'local'. I didn't tested what I describe, but I hope that it should work.

Upvotes: 1

Chad Ferguson
Chad Ferguson

Reputation: 3091

You can use the api to set the start page:

$('#yourgrid').jqGrid('setGridParam', {page: '10'});

Upvotes: 0

Related Questions