using ie8, jqgrid 4.3.3, jquery 1.7.2 or 1.5.2, multiple search seems to miss some search parameters.
on adding a new search row for the 1st time, it appears in the request body but with a blank value (“”)
such as.
"filters":"{\"groupOp\":\"AND\",\"rules\":[{\"field\":\"code\",\"op\":\"eq\",\"data\":\"\"}]}",
subsequent search with the same parameters sends the correct vlaue.
My basic setup is as follows (simplified)
$('#Table').jqGrid({
//....
datatype: 'json',
colNames: ['Code'],
colModel: [{
name: 'Code',
index: 'Code'}],
pager: '#Pager'
}).jqGrid('navGrid', '#Pager', {
add: false,
edit: false,
del: false,
refresh: false
}, {}, {}, {}, {
multipleSearch: true
}).trigger('reloadGrid');
UPDATED: added jsfiddle
after a long time, I found that the error happens only if I am using cmTemplate to specify searchoptions sopt and when I click on ‘find’ without 1st clicking outside the data text box.
See jsfiddle here (remember to click the find button directly after typing the search value)
I suppose, it’s an old bug with refreshing of jqGrid input fields which I described here. You can try to insert the following callback
like here. You can also try to use jqGrid 4.4.1 instead of 4.3.3. The version should have no such problems.
UPDATED: I found that my previously posted and committed changes was reverted back: see here. My suggestions was collection of many improvements:
uiButtons: falseto use the old style.'Add rule','Delete rule','Add subgroup','Delete group')."change"events on all input controls before the final reading of data from the searching dialog.The last changes could be important to fix your problem.
One should modify the implementation of the filterData function. One should add the lines
before the line.
The problem is that jqGrid bind ‘change’ event to all input fields of the searching dialog (see the lines). After the user type the data for the searching the ‘change’ event will be triggered and the internal data
filter(seerule.data, which is the part of thefilter, in the line) will be modified. If the user click on Search button the current value offilterwill be get (see the line). The problem is that thechangeevent will be processed in some web browsers after processing of the'click'event on the “Search” button. So the input data from the last searching filter could be not yet set. The call of.triggerHandler("change")on all input controls before the data from thefilterwill be returned could fix the problem. In the case some unneededchangeevents could be called, but one will be sure that the data infilterare the same as the data from the.I think that reverting of the changes was the bad idea.
If one would use
searchOnEnter: trueoption the usage of.triggerHandler("change")and to start searching with Enter key the problem should not take place because of the linewhere the focus will be explicitly set to “Search” button before processing of the click event. In the way the
"change"event will be indirectly triggered and the data in thefilterwill be refreshed.I think that one can fix the problem which you described without direct triggering of
changeevents. Instead of that one can include explicit setting of the focusinside of
clickevent handler (see the line). It’s important to do this before the line where.jqFilter('filterData')will be called.