5

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

Bhupendra
  • 1,196
  • 16
  • 39

2 Answers2

4

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.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • I am a fan of you, can you tell me a place that have the main diferences of free and non-free jqgrid? Thx –  Jul 22 '15 at 20:39
  • @PauloDiogo: Thank you! The first difference is: jqGrid 4.7 was the last version with MIT licence (you can use or modify the code almost without restriction). Starting with 4.7.1 it's [Guriddo jqGrid JS](http://guriddo.net/?page_id=103334). I made fork of 4.7, made many bug fixes and implemented many features described in many [wiki](https://github.com/free-jqgrid/jqGrid/wiki) articles and short in readmes of [4.8](https://github.com/free-jqgrid/jqGrid/blob/master/README48.md) and [4.9](https://github.com/free-jqgrid/jqGrid/blob/master/README.md). Free jqGrid can be used under MIT/GPL-licences – Oleg Jul 22 '15 at 21:20
  • @Oleg : thanks your your answer it works perfectly. I updated my fiddle http://jsfiddle.net/BHUPENDRA1011/j108Log6/3/ – Bhupendra Jul 23 '15 at 06:03
0

The following loads the array with only the filtered data:

var filteredData = $("#grid")[0].addLocalData( true );
Justin Levene
  • 1,630
  • 19
  • 17