Free Jqgrid Search Parameter Disappearing In Filtertoolbar
Solution 1:
Free jqGrid 4.13.1 introduced new feature - filling of the filter toolbar based on the postData.filters
. See the README4.13.1. The feature had some bugs, which exists in your case. The bugs are fixed in the later version of free jqGrid.
One can switch off the feature by usage loadFilterDefaults: false
(by usage .jqGrid("filterToolbar", {loadFilterDefaults: false})
or better by changing searching: { defaultSearch: "cn" }
to searching: { defaultSearch: "cn", loadFilterDefaults: false }
). On the other side I would better recommend you to update to the current released version of free jqGrid: 4.13.5 or to use the latest sources from GitHub.
The searching option loadFilterDefaults: false
is very practical in many scenarios. For example one can use both filter toolbar and the Searching Dialog. If you would set some filter in the filter toolbar and then opening Searching Dialog, then you will see the current filter in the dialog. You can modify it and apply the new filter. The grid will show the new filter, but the old versions of jqGrid will still display old filter in the filter toolbar. I posted the old answer, which shows how one can fill the filter toolbar based on the current used filter. The new version of free jqGrid will refresh the filter toolbar automatically if the default loadFilterDefaults: true
option of the filterToolbar
is used.
There are other common scenarios where loadFilterDefaults: true
would be helpful. One can, for example, load all JSON data from the server using loadonce: true
option. Free jqGrid allows to combine loadonce: true
option with forceClientSorting: true
, which apply localsorting and filtering before the data will be displayed in the grid. It allows to load all the data, but display only filtered and sorted data with paging the data locally. To filter the data one need just set filters
property of postData
. By usage filterToolbar
with default loadFilterDefaults: true
option one will see the currently applied filter, which could be helpful for the user.
Post a Comment for "Free Jqgrid Search Parameter Disappearing In Filtertoolbar"