Search code examples
javascriptjquery.netjqgridjqgrid-asp.net

filtering data not equal to a specific text jqgrid


Hi ihave loaded a jqgrid with jason data.

I have this filtering

  //  Fetch the text from our <input> control
            var searchString = 'N';
​
            //  Prepare to pass a new search filter to our jqGrid
            var f = { groupOp: "AND", rules: [] };
​
            //  Remember to change the following line to reflect the jqGrid column you want to search for your string in
            //  In this code, I'm searching through the CAR_NO column.
​
            f.rules.push({ field: "CLOSEDDATE", op: "cn", data: searchString });
​
            var grid = $('#Auditgrid');
​
            grid[0].p.search = f.rules.length > 0;
            $.extend(grid[0].p.postData, { filters: JSON.stringify(f) });
            grid.trigger("reloadGrid", [{ page: 1 }]);

It seach close date with N value on it but what i want is to filter data with a CLOSEDDATE not equal to N

is it possible with my current filtering code?


Solution

  • Yes, you can do this - you will need just to look at the available options for searching in language file or documentation.

    Opposite to operator contain is not contaion coded as nc

    In your case this can look like

    ...
    f.rules.push({ field: "CLOSEDDATE", op: "nc", data: searchString });