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

Advanced FilterDescriptor Question

2 Answers 164 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Brendon
Top achievements
Rank 1
Brendon asked on 04 Jun 2010, 12:29 AM
This is what I want to do... tell me if I'm crazy.

I would like to filter data based on a many to many relationship...
Lets say we have People, and Widgets that are tied together via PeopleWidgets.

If I have a grid of People and a column for their Widgets - is it possible to have a custom filtering control that lets them which Widgets to choose from. Actually - I've made it that far, but now the problem is getting the FilterDescriptor to behave as desired. This is what I have...

            List<long> widgetIDs = new List<long>();  
            foreach (CheckBox checkBox in this.ChildrenOfType<CheckBox>().Where(cb => cb.IsChecked == true))  
            {  
                widgetIDs.Add((checkBox.DataContext as Widget).WidgetID);  
            }  
            if (widgetIDs.Count > 0)  
            {  
                Telerik.Windows.Data.FilterDescriptor fd = new Telerik.Windows.Data.FilterDescriptor();  
                fd.Member = "PeopleWidgets.WidgetID";  
                fd.Operator = Telerik.Windows.Data.FilterOperator.IsContainedIn;  
                fd.Value = widgetIDs;  
                  
            } 

But this is obviously not working. Basically I'm trying to go another level deeper in my "Member" property of the FilterDescriptor.

Any ideas?

2 Answers, 1 is accepted

Sort by
0
Brendon
Top achievements
Rank 1
answered on 04 Jun 2010, 02:11 AM
In case anyone else needs a workaround and this can't be done via the FilterDescriptor methods - my current workaround is to raise an event in the Custom Filter Control that is caught by the RadGridView and then uses a QueryParameter of the DomainDataSource to filter the results.
0
Rossen Hristov
Telerik team
answered on 04 Jun 2010, 06:21 AM
Hello Brendon,

You can find my blog post interesting.

In the blog post I have developed a Custom Filtering Control that communicates directly with the DomainDataSource thus eliminating any client-side filtering. I guess you are trying something similar. Check it out, I am filtering on the server without any events whatsoever. My custom control simply "knows" about the
DomainDataSource and operates over it.

I hope this will help.

All the best,
Ross
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.
Tags
GridView
Asked by
Brendon
Top achievements
Rank 1
Answers by
Brendon
Top achievements
Rank 1
Rossen Hristov
Telerik team
Share this question
or