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

How to select a value from a sub-collection

2 Answers 49 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
Erdem
Top achievements
Rank 1
Erdem asked on 01 Jul 2014, 12:19 PM

Hi,

I'm in a situation where I have a sub-collection in my GridView of a complex type and was hoping I could perform a filter like the following:

ItemPropertyDefinition tagDefinition = new ItemPropertyDefinition("Tags.Tag", typeof(string), "Tags");
this.RadDataFilterBlogProperties.ItemPropertyDefinitions.Add(tagDefinition);

This is obviously not working....
In a previous post I saw something about using a QueryableCollectionView with Linq and binding it to the DataFilter.
...but after doing some research I can't even find an event where I can overwrite/bypass the default filter behaviour of the datafilter.

---

My current solution/workaround is adding an extra property to the collection that is bound to the GridView that has all the strings from the sub-collection combined ... and letting the DataFilter, filter on that field...  But this method is slow and not really correct.

Thanks in advance,


2 Answers, 1 is accepted

Sort by
0
Erdem
Top achievements
Rank 1
answered on 02 Jul 2014, 10:08 AM

Currently the only solution I see is using the propertychanged Event of IFilterDescriptor

use unbound mode
Do Not add the filterdescriptor from te DataFilter to the GridView.
Instead create an eventhanderl for propertychanged
In the propertychanged create a new filterdescriptor (Based on a Linq expression) and apply it to the GridView
create a dictionary and keep the Original filterdescriptor with the new filterdescriptor together
The Original filterdescriptor will now only be used for visual usability ... when it is deleted or emptied, look up the key in the dictionary and delete from Grid and dictionary.

This seems to work, untill I run accros CompositeFilterDescriptor.

The same logic should be applicable to CompositeFilterDescriptor but since this can have a recursive amount of levels of FilterDescriptors, this is really getting extremely complex ..

in order to make it easier, I'm trying to Clone the original compositeFilterDescriptor and just modify where necessary, but the inbuilt clone functionality seems to return a Freezable type that I can't use.






0
Dimitrina
Telerik team
answered on 04 Jul 2014, 11:01 AM
Hello,

You can check this forum thread on a similar topic. This one may also be useful:
DataFilter for Complex Type.

Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
DataFilter
Asked by
Erdem
Top achievements
Rank 1
Answers by
Erdem
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or