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

Filtered CollectionView as RadGridView

2 Answers 247 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Geoff Smith
Top achievements
Rank 1
Geoff Smith asked on 02 Aug 2010, 01:26 PM
I have a grid that I only ever want to show a subset of data items. I want the user to be able to play around with the filters, so I've created a CollectionView based on the original collection that has the permanent filter set. This CollectionView is set as the grid's ItemsSource so that the permanent filter and the user defined filters (FilterCollection) are kept separate.

However, I get an index out of bounds exception when adding items to the original collection. It looks like this is because the INotifyCollectionChangedEventArgs are specifying an index that is present in the original collection, but too high once the CollectionView filter has been applied.

Is this a strategy that should work and I'm missing something, or does anyone know of a better way to have a filter always set on the grid, despite calling FilterCollection.Clear() (my fallback strategy is to now create a FilterDescriptor to do the same job and re-add it every time I clear the filters).

2 Answers, 1 is accepted

Sort by
0
Accepted
Milan
Telerik team
answered on 04 Aug 2010, 02:34 PM
Hello Geoff Smith,

I have prepared a sample that demonstrates how you can utilize ListCollectionView to apply a permanent filter.


Best wishes,
Milan
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
Geoff Smith
Top achievements
Rank 1
answered on 04 Aug 2010, 03:04 PM
Thanks for sending that, I love that you guys whip up example projects just like that! I was pretty much there except that I was using a CollectionView instead of a ListCollectionView... I'm not entirely sure what that was a problem, but switching fixed it for me. 

Thanks again :-)
Tags
GridView
Asked by
Geoff Smith
Top achievements
Rank 1
Answers by
Milan
Telerik team
Geoff Smith
Top achievements
Rank 1
Share this question
or