Campus Labs
Top achievements
Rank 1
Campus Labs
asked on 25 Oct 2010, 01:50 PM
As described in my previous post, I've created a custom field editor for the RadFilter and restricted the available filter functions in the filter menu. The available functions are Contains, DoesNotContain, IsEmpty, and NotIsEmpty. When the editor is first created, however, the default filter function selected is EqualTo - even though EqualTo is not allowed in the menu. I've attached a screenshot where you can see EqualTo is selected even though it isn't in the list of available filter functions.
I'm guessing that since I'm hiding the filter menu items client-side, the RadFilter doesn't know that EqualTo is not a valid selection for a filter function when creating the new field editor server-side. How can I change the default filter function for my custom field editor to be Contains instead of EqualTo?
I'm guessing that since I'm hiding the filter menu items client-side, the RadFilter doesn't know that EqualTo is not a valid selection for a filter function when creating the new field editor server-side. How can I change the default filter function for my custom field editor to be Contains instead of EqualTo?
6 Answers, 1 is accepted
0
Hi Ross,
In order to overcome that issue for the filter expressions added manually, you need to create a different type of expression but RadFilterEqualToFilterExpression<T> expression for the particular column.
Check it out and let me know if this works for you.
Kind regards,
Iana
the Telerik team
In order to overcome that issue for the filter expressions added manually, you need to create a different type of expression but RadFilterEqualToFilterExpression<T> expression for the particular column.
Check it out and let me know if this works for you.
Kind regards,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Campus Labs
Top achievements
Rank 1
answered on 29 Oct 2010, 07:53 PM
Thanks for your response, Iana. It looks like the solution you've provided will work when manually populating the RadFilter with a set of expressions. However, I'm trying to accomplish a slightly different task. I'll try to walk through my goal here.
Let's say I have a RadFilter that can edit two fields – Number and Responsible Role. By default, the page loads with an empty RadFilter (that is, it has no expressions pre-populated). I click on the Add Expression button to get my first filter expression editor. By default, this editor will load "Number equal to _____" since Number is the first filterable field. At this point, let's say I want to filter by Responsible Role. I use the field name dropdown to change "Number" to "Responsible Role". Now the expression editor reads "Responsible Role equal to _____". It is here that "equal to" shows up as the default filter function and I’d like to change that default filter function to "contains".
I apologize for not being clearer in my original post and appreciate your help.
Let's say I have a RadFilter that can edit two fields – Number and Responsible Role. By default, the page loads with an empty RadFilter (that is, it has no expressions pre-populated). I click on the Add Expression button to get my first filter expression editor. By default, this editor will load "Number equal to _____" since Number is the first filterable field. At this point, let's say I want to filter by Responsible Role. I use the field name dropdown to change "Number" to "Responsible Role". Now the expression editor reads "Responsible Role equal to _____". It is here that "equal to" shows up as the default filter function and I’d like to change that default filter function to "contains".
I apologize for not being clearer in my original post and appreciate your help.
0
Accepted
Hi Ross,
There is a way to achieve your goal. You need to handle the ItemCommand and change the expression type there as in the attached sample.
We will consider exposing new properties and events so this scenario is easily implemented.
Check it out and let me know if this works for you.
All the best,
Iana
the Telerik team
There is a way to achieve your goal. You need to handle the ItemCommand and change the expression type there as in the attached sample.
We will consider exposing new properties and events so this scenario is easily implemented.
Check it out and let me know if this works for you.
All the best,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Leo
Top achievements
Rank 1
answered on 11 Nov 2010, 10:53 AM
Hi Iana,
what if I want to replicate this behaviour when I click Add expression Button?
Because I want that all fields get "Contains" as default filter expression...
Thanks :)
Leo
what if I want to replicate this behaviour when I click Add expression Button?
Because I want that all fields get "Contains" as default filter expression...
Thanks :)
Leo
0
Hello Leo,
I assume that changing the if statement so it covers your requirement should be enough. Otherwise the logic used should be the same.
Regards,
Iana
the Telerik team
I assume that changing the if statement so it covers your requirement should be enough. Otherwise the logic used should be the same.
Regards,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Campus Labs
Top achievements
Rank 1
answered on 15 Nov 2010, 04:50 PM
Thanks, Iana. That solution worked great.
The only remaining issue was the expression being changed would be added to the end of the list of expressions in that group instead of remaining in the same location in the UI. I made a small change so the expression being edited remains in the same location:
The only remaining issue was the expression being changed would be added to the end of the list of expressions in that group instead of remaining in the same location in the UI. I made a small change so the expression being edited remains in the same location:
Int32 expressionIndex = e.ExpressionItem.OwnerGroup.Expression.Expressions.IndexOf(((RadFilterSingleExpressionItem)e.ExpressionItem).Expression);
e.ExpressionItem.OwnerGroup.Expression.Expressions.Remove(((RadFilterSingleExpressionItem)e.ExpressionItem).Expression);
e.ExpressionItem.OwnerGroup.Expression.Expressions.Insert(expressionIndex, newExpression);