This is a migrated thread and some comments may be shown as answers.

[Solved] Is there an Or operator for filtering?

2 Answers 47 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jeremy Casper
Top achievements
Rank 1
Jeremy Casper asked on 10 May 2010, 11:43 PM
I need the ability to set multiple filter criteria for a column where the value can match any one of the criteras. For example, I have a state column that will contain the state abbreviation. I need the ability to allow users to select multiple states and have the grid filter all of the results that are in the states that the user selected. Is this possible currently? I have not seen any way to accomplish this. Any help would be appreciated.

2 Answers, 1 is accepted

Sort by
0
Jeremy Casper
Top achievements
Rank 1
answered on 11 May 2010, 04:38 PM
After researching inside the telerik dll I found that there is an or operator. It is not exposed directly and had to modify the javascript file to include the Or operator. I am running into another issue. I can add 2 filter conditions on one column and it will work but as soon as I add a third condition I cannot get the grid to display any results. How can i have more than 2 conditions for a column? I need the grid to handle as many conditions as needed. Any suggestions on where I can look to modify this setting?
Thanks
Jeremy
0
Jeremy Casper
Top achievements
Rank 1
answered on 11 May 2010, 09:52 PM
After further research. I have found that the GridCommand only has the first two filters passed along. So it was filtering with the or just not with all of the criteria. Looking into the dll I have found that when the filter node is parsed using the or operator path there doesn't seem to be any recursion. When I look at the and operator path there is recursion. Is this on purpose?

private IFilterNode OrExpression()  
{  
    IFilterNode firstArgument = this.AndExpression();  
    if (this.Is(FilterTokenType.Or))  
    {  
        return this.ParseOrExpression(firstArgument);  
    }  
    if (this.Is(FilterTokenType.And))  
    {  
        this.Expect(FilterTokenType.And);  
        AndNode node2 = new AndNode();  
        node2.First = firstArgument;  
        node2.Second = this.OrExpression();  
        return node2;  
    }  
    return firstArgument;  
}  
 
private IFilterNode ParseOrExpression(IFilterNode firstArgument)  
{  
    this.Expect(FilterTokenType.Or);  
    IFilterNode node = this.AndExpression();  
    OrNode node2 = new OrNode();  
    node2.First = firstArgument;  
    nodenode2.Second = node;  
    return node2;  
}  
 
 
Tags
Grid
Asked by
Jeremy Casper
Top achievements
Rank 1
Answers by
Jeremy Casper
Top achievements
Rank 1
Share this question
or