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

grid filter compares cell values

4 Answers 42 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jax
Top achievements
Rank 2
Jax asked on 15 Jun 2010, 01:45 PM
I'm looking for a sample on how to programmatically add a filter that will compare cell values.

eg: Filter rows where cell B or Cell C values is different to Cell A value.

4 Answers, 1 is accepted

Sort by
0
Stefan Dobrev
Telerik team
answered on 16 Jun 2010, 11:53 AM
Hi Jax,

You can use the PredicateFilterDescriptor class used in this blog post. It allows you to define what ever expression you like as a filter predicate.

Best wishes,
Stefan Dobrev
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
Jax
Top achievements
Rank 2
answered on 17 Jun 2010, 10:00 AM
Stefan,

Thanks - looks like it should work. It would be nice, however, not to have to import all those complicated
custom classes (PredicateWriter etc. ) into my source just to achieve a simple filter.

If I want to filter out records where I need to compare cell \ instance values, the implementation should be as simple as overriding a method on an InstanceFilter that returns a bool, and accepts a row instance as parameter.

That way all I have to worry about is analysing the instance properties to see if it should be filtered or not.
0
Accepted
Stefan Dobrev
Telerik team
answered on 17 Jun 2010, 10:07 AM
Hello Jax,

If this is too complicated you can use CollectionViewSource for filtering as illustrated here.

Kind regards,
Stefan Dobrev
the Telerik team
0
Jax
Top achievements
Rank 2
answered on 17 Jun 2010, 12:30 PM
Stefan - although not as simple as my suggestion above - definitely more workable - Thanks.
Tags
GridView
Asked by
Jax
Top achievements
Rank 2
Answers by
Stefan Dobrev
Telerik team
Jax
Top achievements
Rank 2
Share this question
or