Jerry P Jerry P - 6 months ago 68
jQuery Question

free-jqGrid 4.13.4 multiselect toolbar filter not working

I have looked at all of the Q & A about the use of the Multiselect widget in the filter toolbar of jqGrid. I have noticed that in almost all the solutions, the jqGrid versions and the jquery versions are not current ones. I am using the most current versions of both jqGrid (4.13.4) and jquery (3.1.1) and jqueryUI (1.12.1).

I have tried the sample code from here in my javascript. It loads fine, but when I try to choose any of the values from the multiselect, the grid clears and remains cleared even when deselecting the values from the multiselect.

I just want to make sure that this solution works with the most current versions of free-jqGrid, jquery, and jqueryUI that I am using.


Here's the fix for the "Any" option in the drop down to return all the options in the select control.

Modify this section of the code:

modifySearchingFilter = function (separator) {
var i, l, rules, rule, parts, j, group, str,
    filters = $.parseJSON(this.p.postData.filters);
rules = filters.rules;
for (i = 0; i < rules.length; i++) {
    rule = rules[i];
    if ( == "") {
        rule.op = "ne"; //this will return anything not equal to ""
console.log("after splicing: " + JSON.stringify(filters))
this.p.postData.filters = JSON.stringify(filters);},

The important part if to add the check of the rules and return a not equal ("ne") for the operator. This will create a rule that filters out all options that are not equal to an empty string. This should return all the select options, in other words, reset the select to it's initial state which shows all the options in the select and it will return all the records in the grid. Hope this helps in the future.