jqGrid v4, custom search form, how to?

oxodesign picture oxodesign · May 2, 2011 · Viewed 9.9k times · Source

Im having some problems creating a custom search form for jqGrid, on the last version (v4).

I used before this method:

jQuery("#search-form").jqGrid(
    'filterGrid',
    '#grid', 
    options
); 

However it does not work anymore, can someone give me an example on how to do this on version 4 of jqGrid?

Answer

Oleg picture Oleg · May 2, 2011

To use the method filterGrid in jqGrid 4.0 you need include grid.addons.js from the plugins subdirectory.

How you can reed here the method filterGrid can be removed in the next major version of jqGrid. So I recommend you to consider to use some alternatives. You can create any list of custom form controls to allow user to define the grid filtering. To apply the filtering you need just to fill filters property of postData parameter and set search parameter of jqGrid to true. After that the call of trigger("reloadGrid") will apply the filtering. In the way you will be absolutely flexible and independent.

Below you can find some old answers where the idea with filters are implemented in different ways: here, here, here, here, here and so on.