free-jqgrid

Free jqGrid - more than 1 custom soft and advanced search always get into the first decleration


Seems like customSortOperations is always taking the first element out of 5 I have.

I have set on the colModel searchoptions['sopt'] = ['il','nl','em','nm']; I have within the customSortOperations = {'posix':{buildQueryValue}.'il':{buildQueryValue},'nl':{buildQueryValue},'em':{buildQueryValue},'nm':{buildQueryValue}}

But whatever I choose from the 4 soft, it always goes into the posix buildQueryValue.

Thanks,

Tal.


Solution

  • Found the bug:

    if (opC === "" && p.cops != null) {
                        for (oper in p.cops) {
                            **if (p.cops.hasOwnProperty(oper)) {**  
                                opC = oper;
                                operand = p.cops[oper].operand;
                                if (isFunction(p.cops[oper].buildQueryValue)) {
                                    return p.cops[oper].buildQueryValue.call(p, { cmName: rule.field, searchValue: val, operand: operand });
                                }
                            }
                        }
                    }

    Should be changed to:

    if (opC === "" && p.cops != null) {
                        for (oper in p.cops) {
                            //if (p.cops.hasOwnProperty(oper)) {
                            **if (oper === rule.op) {** 
                                opC = oper;
                                operand = p.cops[oper].operand;
                                if (isFunction(p.cops[oper].buildQueryValue)) {
                                    return p.cops[oper].buildQueryValue.call(p, { cmName: rule.field, searchValue: val, operand: operand });
                                }
                            }
                        }
                    }