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

Custom IColumnFilterDescriptor and standard FilteringControl

0 Answers 131 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Evgeniy
Top achievements
Rank 1
Evgeniy asked on 07 Feb 2012, 02:37 PM
Hi.

I have
 1. Using RadTreeListView
 2. 2 level hierarchy

Here is what I am trying to achieve:
 1. When by 1 column some parent row is filtered, always show all it;s children rows, no matter if they pass same filter or no.

 I know this is not supported in standard FilteringControl and ColumnFilterDescriptor functionality, at least not right now.

 I have considered several options, but decided to choose one I was thinking would be least expensive in terms of coding:
 1. Created a ColumnFilterDescriptor Decorator, using IColumnFilterDescriptor interface, this Decorator does everything the same as standard ColumnFilterDescriptor, except when it's  CreateFilterExpression() method is called, I modify the Expression the original ColumnFilterDescriptor.CreateFilterExpression() method returns, so it would also include child rows of any row that passes the original Expression.
 2. Now when I have that custom ColumnFilterDescriptor, I subscribe to RadTreeListView's Filtered event and substitute (like: treeView.FilterDescriptors[indexOfOriginalDescriptor] = decorator) our column's ColumnFilterDescriptor with my Decorator.

 And that approach works to an extent, but now the problem is this: when I select the first distinct filter, CreateFilterExpression() on my Decorator is correctly called (probably because it got added to FilterDescriptors collection of RadTreeListView), but when I select 2nd distinct value, CreateFilterExpression() method is just never called at all.
 So I guess the problem is that standard FilteringControl loses it's connection to my Decorator (maybe it doesn't even have that at all) or to it's original ColumnFilterDescriptor (reference to which is kept inside the Decorator).

 And finally my questions:
1. How standard FilteringControl maintains it's connection to ColumnFilterDescriptor it is adding to FilterDescriptors collection?
2. Is it possible to make this decorator approach work at all? Or I must re-implement FilteringControl somehow too?
3. Is the "Show child rows whenever parent row passes filter" feature implemented yet? I am using "2011.1.315.1040" version, which isn't latest.

P. S.: The idea of this whole scenario was that standard FilteringControl will hold on to original ColumnFilterDescriptor and make changes to if whenever user uses the Filter UI, and Decorator will be queried each time something changes. But somehow this doesnt happen. Should I call something to make grid re-query it's FilterDescriptors?
P. P. S.: Actually, when user check second Distinct filter, Filtered event is called on grid, but CreateFilterExpression() is never called again. How does this CreateFilterExpression() mechanics work?

No answers yet. Maybe you can help?

Tags
TreeListView
Asked by
Evgeniy
Top achievements
Rank 1
Share this question
or