Skip to content

Replies

0
Mohammed Gaggutur
Mohammed Gaggutur answered on Jul 14, 2020 6:53 PM

I see. But if I want to get rid of one of the filtering trees, how would I do that?

In your example, if I wanted to get rid of this condition:

const productExpression = {
        condition: IgxStringFilteringOperand.instance().condition("contains"),
        fieldName: "ProductName",
        ignoreCase: true,
        searchVal: "Queso"
      };
But keep the second condition only after applying both condititons:
const productExpressions2 = {
        condition: IgxStringFilteringOperand.instance().condition("contains"),
        fieldName: "ProductName",
        ignoreCase: true,
        searchVal: "Cabrales"
      }
how would I do that?
Would I have to clear all conditions and apply only the ones I want to see?
0
Mohammed Gaggutur
Mohammed Gaggutur answered on Jul 13, 2020 7:06 PM

Hi,

Yes I have tried that.

In this case when I want to filter out val '1' it would be:

const tree = new FilteringExpressionsTree(FilteringLogic.And);
    tree.filteringOperands.push({
        fieldName: 'Sort',
        condition: IgxNumberFilteringOperand.instance().condition('isNotEqual'),
        searchVal: 1
    });
this.grid.advancedFilteringExpressionsTree = tree;
So now we should get:

sort

column1

column2

2

2

3

3

And then when I want to filter out value '2' as well as value 1 at the same time it would be:
this.grid.advancedFilteringExpressionsTree.filteringOperands.push({
      fieldName: 'Sort',
      condition: IgxNumberFilteringOperand.instance().condition('isNotEqual'),
      searchVal: 2
    });
Which should result in:

sort

column1

column2

3

3

Is this the correct implementation?