iuristona
iuristona

Reputation: 927

Sync jqGrid filterToolbar and searchGrid filters

I am using a jqGrid with both filterToolbar and searchGrid.

When I perform a search using the filterToolbar and then open the searchGrid window, the filters come filled fine.

But when I change something after this, this feature stop working.

I can explain by testing this sample: http://srv04.wln.com.br/cpsadmin/sample

Try typing an 'a' for the fields Name, Address and City in the filterToolbar, then perform a search (pressing return when focus in any input).

After that, click in the 'Find Records' button at the footerBar, this will open the search window, with the 3 fields filleds according with the filterToolbar searchoptions.

But if we try to do something after this, nothing works ok again, since we refresh the page.

I would like to get the power of both, filterToolbar and searchGrid, working together, and in the two ways.

Upvotes: 0

Views: 3171

Answers (1)

Oleg
Oleg

Reputation: 221997

You can try to add recreateFilter: true searching option. To be able to find the exact reason of the problem you should use jquery.jqGrid.src.js instead of jquery.jqGrid.min.js on your demo page.

I recommend you additionally to use refreshSerchingToolbar function which I suggested in the answer. One more answer with the demo could be also interesting for you. It show how to save last searching filter (and some other information) in the localStorage. At the visit of the same page the previous used searching filter will be applied.

UPDATED: It's a little the matter of the tasted, but I personally use the settings

$.extend($.jgrid.search, {
    multipleSearch: true,
    multipleGroup: true,
    recreateFilter: true,
    closeOnEscape: true,
    closeAfterSearch: true,
    overlay: 0
});

or some more advanced version as my default Advanced Searching settings. The recreateFilter: true like recreateForm: true for the form editing are always my default settings. I suggested many times (see here for example) to make the settings as jqGrid defaults, but the suggestings stayed unanswered. Tony (the developer of jqGrid) has another opinion on the subject.

Upvotes: 1

Related Questions