JQGRID , get all rows after filtering

2019-04-09 18:25发布

问题:

I am not able to get all rows { paginated } after filtering JQgrid . I tried

  > var myData = grid.jqGrid('getGridParam', 'data'); 
var myData = grid.jqGrid('getRowData');

but first option gives all rows and these are unfiltered rows. second one returns filtered rows but only from first page.

In fiddle example if you type test in Client columns there are 6 filtered results, but first option returns all 7 records , and second one returns only 5 records { ie only from first page}. I need to show 6 filtered records. results are logged in console.

Here is fiddle

回答1:

The solution of the problem depend on which fork of grid you use. Free jqGrid is the fork based on jqGrid 4.7 (see readme and wiki for additional information). The current version of free jqGrid is 4.9.

Free jqGrid supports lastSelectedData parameter which you can use instead of data to the informational which you need. See the demo.

If you have to use old jqGrid version and can't update it to free jqGrid then you can follow the answer. It shows how one can "subclass" select method of the internal $.jgrid.from class of jqGrid. After the subclassing one have access to the required information.