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
25
filtering multiple columns
posted

Hallo,

I want to filter iggrid programmatically in the following form:

column1: "value equals X" OR "value equals Y"

AND

column2: "value equals Z".

I could not figure out how that can be done -> can it be done? And if: How?

kind regards

Arnold

  • 23953
    Verified Answer
    Offline posted

    Hello Arnold,

    The igGridFiltering.filter API method has a logic property in the expressions parameter, so you can use it to indicate your filtering logic for a single condition (Currently we do not support grouping of filtering conditions by logic, so it may not suit your need in certain scenarios.) You should try it and see if it works for you.

    For example the here is a code which will filter the data in correct way:

    $("#grid1").igGridFiltering("filter", [
    {fieldName: "MakeFlag", expr: true, cond: "true" , logic: "AND"},
    {fieldName: "ProductID", expr: 3, cond: "equals", logic: "OR"},
    {fieldName: "ProductID", expr: 2, cond: "equals", logic: "OR"}
    ], true);

    What you have to keep in mind is to always put your AND logic conditions in the first place followed by the OR logic conditions.

    If you don't want to enable the igGridFiltering feature you can directly use the igDataSource.filter API. To get a reference to the igGrid underlying data source object you can use the following code:

    $("#grid1").data("igGrid").dataSource;

    P.S.: You can log a new product idea for the grouping of filtering conditions by logic in igDataSource.

    Hope this helps,
    Martin Pavlov
    Infragistics, Inc.