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

Source properties displayed

11 Answers 54 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
Lutz
Top achievements
Rank 1
Lutz asked on 17 Mar 2014, 10:52 PM
I'm using RadDataFilter in Bound mode.
I have a bunch of objects in the Source list that I'd like to filter that are of different types. They're all derived from a base class. The dropdown in the filter only shows the properties in the base class. Is there a way to make the dropdown show all properties that have a [Display] attribute on them, even though they are in different derived classes?

For example, if I derive class Manager from your Employee class and add a new property bool HasCar to Manager with the [Display] attribute, I'd like that property to also be available for filtering. Any non-employees (objects that don't have that property) should be ignored (i.e. always culled out). Is this possible? Or do I need to go to Unbound mode and write all the filtering code myself?

- Lutz

11 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 20 Mar 2014, 04:57 PM
Hello Lutz,

Please take a look at this forum thread for a reference: "Data Filter and Inheritance".


Regards,
Maya
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
0
Lutz
Top achievements
Rank 1
answered on 20 Mar 2014, 05:51 PM
Thanks Maya, that is what I suspected.

So I will need to switch to unbound mode and implement the filtering code myself.... Is there any sample that shows how to evaluate the FilterDescriptors?

- Lutz
0
Dimitrina
Telerik team
answered on 24 Mar 2014, 11:34 AM
Hi Lutz,

You can check the RadDataFilter Unbound Mode article as an example.

Regards,
Didie
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
0
Lutz
Top achievements
Rank 1
answered on 24 Mar 2014, 04:39 PM
No, that article in no way explains how to do that. All it shows is how to transfer the FilterDescriptors to the GridView, which then does the filtering. I am not using a GridView, however, so I need to evaluate the filters myself, but I can't find any sample code that demonstrates how to evaluate the descriptors.....

- Lutz
0
Dimitrina
Telerik team
answered on 26 Mar 2014, 04:24 PM
Hello Lutz,

In order to evaluate the filters directly through the RadDataFilter, you will have to add or remove the filters from RadDataFilter.FilterDescriptors collection. 

Regards,
Didie
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
0
Lutz
Top achievements
Rank 1
answered on 26 Mar 2014, 05:13 PM
Ummm, what? Either you aren't really reading what I'm writing and asking, or I'm really bad at explaining myself....

I have a RadDataFilter in my app that will allow users to create a filtering query.
I do NOT have a RadGridView.
I have a list of objects (different types in a class hierarchy) that need to be filtered.
I have to use Unbound mode because of the class hierarchy.
When it's time to do the filtering, I have to figure out whether a specific instance satisfies the filter query or not.
The filter query is in the form of the FilterDescriptors list.
I now need to iterate over the FilterDescriptors and figure out whether my specific instance satisfies the filter.
Is there sample code for that?

- Lutz
0
Dimitrina
Telerik team
answered on 27 Mar 2014, 08:10 AM
Hello,

You say you have a list of objects and you do not have a RadGridView. Where do you populate the data you would like to filter? As I understand you would like to filter it from this control.

Does the suggestion and the the demo code sent by my colleague in the other forum thread you have opened on how to filter in unbound mode not work for you?

In order to avoid any further misunderstanding, may I ask you to send me a demo solution with your specific setup? 

Regards,
Didie
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
0
Lutz
Top achievements
Rank 1
answered on 27 Mar 2014, 06:23 PM
I have a custom control (3D visualizer) that uses a databound list of objects that I was hoping to filter with RadDataFilter.

The demo code from your colleague on the other thread is the same as in the Telerik Browser and does not do what I need. It simply transfers FilterDescriptors from the RadDataFilter to the RadGridView. I'm guessing that the RadGridView knows how to evaluate the FilterDescriptors against its list of objects. However that is obviously not a viable solution for my custom control, since it does not know how to interpret the FilterDescriptors.

I have written a lot of code that iterates over and recurses into the FilterDescriptors in an attempt to evaluate the FilterDescriptors, but it's not done and it looks like it is going to be way too much work.

If you made the evaluation engine of the Filters more transparent I might have been able to hook into it somewhere....

I will try to come up with a sample when time permits.

- Lutz
0
Dimitrina
Telerik team
answered on 01 Apr 2014, 12:16 PM
Hello Lutz,

You will need to have your source collection interpreting the FilterDescriptors. Unfortunately RadDataFilter cannot control this. As your control does not expose FilterDescriptors itself, I can suggest you wrapping the source collection in such a proper collection. For example you can consider the QueryableCollectionView.
For example:
MyViewModel model = new MyViewModel();
QueryableCollectionView vvv = new QueryableCollectionView(model.Clubs);

Then use this instance as a source for your control. That way you can work with this collection and its FilterDescriptors collection.

How does this work for you?

Regards,
Didie
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
0
Lutz
Top achievements
Rank 1
answered on 01 Apr 2014, 03:49 PM
As I understand it, your filters do not work with an object class hierarchy, reverting to the lowest common base class for the list of properties to allow filtering on. I don't think that using a QueryableCollectionView will change that since your underlying filter implementation won't be able to process my different class instances. Which is why I'm trying to interpret the FilterDescriptors manually.

- Lutz
0
Dimitrina
Telerik team
answered on 01 Apr 2014, 03:57 PM
Hi,

It is not mandatory that the ItemsControl has FilterDescriptors collection itself. You will operate through the bound source collection ("vvv") in this case.
Having the filtering criteria defined with RadDataFilter, you should ensure your source collection is filtered out. If it does not support FilterDescriptors itself, you will have to ensure this manually (as per the capabilities of the particular collection).

Regards,
Didie
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
Tags
DataFilter
Asked by
Lutz
Top achievements
Rank 1
Answers by
Maya
Telerik team
Lutz
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or