I am using jqgrid with multiplegroup option true for search. My filter looks like the following:
{"groupOp":"OR",
"rules":[{"field":"Total_case","op":"eq","data":"29"}],
"groups":[{"groupOp":"AND",
"rules":[{"field":"Total_case","op":"eq","data":"2"},{"field":"percent","op":"eq","data":"100"}],
"groups":[]}]}
I have rows with both total case = 2 ,percent = 100 and total case = 29. Since outer condition is “OR” condition, I am expecting two rows. However it displays no record. What is wrong?
The question seems be duplicate from answer your previous question. I just wrote the answer on your original question where I confirmed that it’s a bug in the current version of jqGrid. As a workaround I suggested to modify requests having
"groupOp":"OR"and both non-empty partsrulesandgroupsso that therulespart will be inserted as new additional group inside ofgroups.On the example which you posted one can first use jQuery.parseJSON to convert the JSON string
postData.filterswhich you posted to the object formThen one could test that
groupOpis “OR” and bothrulesandgroupsare non-empty arrays. In the case one can move therulespart inside ofgroups. In other words one could convert it to the following objectAt the end one can use
JSON.stringifyto convert the object back to JSON string and assign the results back topostData.filters.UPDATED: I posted the pull request which describe the changes which will do jqGrid internally during processing of the filtering/searching request.
The demo uses the fix and it seems that all works correctly now.