I'm having an internal manipulation over the paging mechanism, so I get the ofset using:
xhr.getResponseHeader("X-list-paging-offset")
And the total using:
xhr.getResponseHeader("X-list-size");
During the callback "beforeProcessing".
So far, so good. The issue I have is with the filtering. When I filter the results while I'm on the 3rd page (example), suppose the filter ends up with only one page of results, I stay on the 3rd page which is empty....
My question is, how do I know to "reset" the page counter when I'm doing filtering? so that the pager will always reset to 1 when filter is initiated?
Thanks,
Tal.
It's strange, because during filtering the page
parameter will be explicitly set to 1
. I suppose that you should search for the origin on the problem in the code of beforeProcessing
which you don't posted here. By the way you can use var p = $(this).jqGrid("getGridParam");
or var p = this.p;
to get the option of jqGrid inside of beforeProcessing
. You can test p.search
or p.postData
to get jqGrid used in request to the server. You can use the value in your logic of beforeProcessing
callback. I recommend you to use Fiddler or Developer Tools of IE/Chrome/Firefox to verify that page
number which will be set to the server is 1 during searching or searching reset.
Only if will find that the reason of the problem is do in wrong options of reloadGrid
then I can suggest you an alternative. The current version of free jqGrid from GitHub (the feature included after publishing 4.8 version) contains reloadGridSearchOptions
, reloadGridResetOptions
and reloadGridOptions
options. It can be that the option can help you. The options reloadGridSearchOptions
, reloadGridResetOptions
are supported inside of searchGrid
and triggerToolbar
/clearToolbar
of filterToolbar
. One can use the grid option searching
or $.jgrid.search
to specify it.
The methods editGridRow
, delGridRow
and navGrid
support reloadGridOptions
options. One can use jqGrid option formEditing
, formDeleting
and navOptions
to specify the option reloadGridOptions
or $.jgrid.edit
, $.jgrid.del
, $.jgrid.nav
.
Moreover jqGrid support now reloadGridOptions
option and so the option
$.jgrid.defaults.reloadGridOptions
too.
All the above options allows to specify any reloadGrid
options used during reloading.