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

Accessing Filtered items, with paging

2 Answers 289 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Aksel
Top achievements
Rank 1
Aksel asked on 29 Nov 2012, 02:55 PM
Hi,

I'm using a RadGridView to display several thousand objects stored in an ObservableCollection.
The GridView is bound to the PagedItems on a DataPager, which is bound to the ObservableCollection.
I use filters on the columns in the GridView to filter down the data, so that instead of 250 pages, I get 5 pages.

How can I access these items in these pages? That is, all the items that matches the filter, and not only the items on the current page.
(the items on the current page I can access by gridView.Items, but it does not show the whole collection)

2 Answers, 1 is accepted

Sort by
0
Aksel
Top achievements
Rank 1
answered on 29 Nov 2012, 03:57 PM
Ok, sorry that I'm rubber ducking you, but I think I solved it.
I wrapped the Pager's Source in a QueryableCollectionView, and added all FilterDescriptors from the GridView to that CollectionView.

var view = new QueryableCollectionView(AlarmPager.Source);
foreach (var filterDescriptor in AlarmGrid.FilterDescriptors)
{
    view.FilterDescriptors.Add(filterDescriptor);
}
 
var alarmExs = view.Cast<AlarmEx>();

AlarmExs now contains the whole filtered collection.
0
Dimitrina
Telerik team
answered on 29 Nov 2012, 04:44 PM
Hi,

Indeed the GridView knows only about (is aware of) the Items currently available. Thank you for sharing your solution with the community.

Greetings,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Aksel
Top achievements
Rank 1
Answers by
Aksel
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or