Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
415
filtering multiple columns with 'doesNotContain' and 'AND' logic
posted

I have a requirement for hiding the grid records which have following conditions:

- ns_of_items is 0 AND tk_name have 'item name' in it and code I am trying to implement is as follows:

$(grid_id).igGridFiltering('filter', ([
    { fieldName: "ns_of_items", expr: 0, cond: "doesNotEqual", logic: 'AND' },
    { fieldName: "tk_name", expr: 'item name', cond: "doesNotContain", logic: 'AND' },
]));

The problem is, this logic removes any record which has 'ns_of_items' as 0 for any records. Ignoring if the tk_name has 'item name' or not. 

Any help is appreciated.

Parents
No Data
Reply
  • 15320
    Offline posted

    Hello sarojanand,

    Did you try to use "OR" logic for the second filtering expression, like for instance:


    $(grid_id).igGridFiltering('filter', ([
        { fieldName: "ns_of_items", expr: 0, cond: "doesNotEqual", logic: 'AND' },
        { fieldName: "tk_name", expr: 'item name', cond: "doesNotContain", logic: 'OR' },
    ])); ?

    When you use "AND-AND" logic to filter your records, then the filtering widget passes through all the records and looks for every single record if it fits both ns_of_items!==0 and tk_name!=="item name" conditions. In your case there might not be any records that satisfy this condition.

    Please try AND-OR logic instead and let me know if it helps you resolving your issue.

    Regards,
    Tsanna

Children
No Data