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

Paging / Filtering / Aggregates

3 Answers 62 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Randy
Top achievements
Rank 1
Randy asked on 13 Feb 2014, 03:49 AM
So I have a grid that contains several thousands of records and about 15 columns.  Currently this grid is not paged and has some aggregate totals (custom) on several of the columns.  When the calculations occur I am getting the items collection from the grid itself.

var items = this.ParentOfType<RadGridView>().Items

I then loop through each item and calculate my totals.  It works perfectly.

Except the performance on the grid is horrible.  My boss wants to add more columns to the grid and we are getting larger customers.  It seems like the only solution is to go to a paging grid.  This solves the performance issues, but now my aggregate functions are not working correctly when the grid is filtered.  

Take for example a paging grid with a it's ItemSource bound to a DataPager.  The datapager has a source that consists of 1,000 records and is set to page on 100 items.  The grid shows the first 100 records on page 1 of 10 pages.  The user then applies a column filter that has 250 results.  The grid now is viewing the results for page 1 (of 3).  I can see by the ItemCount property on the DataPager that there is 250 records.  But I cannot access those records.  I have access to the full list of 1,000 via the Source property and the filtered list of data FOR PAGE 1 in PagedSource.  But I need to parse all 250 records to properly update me column aggregates.

Is there a solution?

3 Answers, 1 is accepted

Sort by
0
Randy
Top achievements
Rank 1
answered on 14 Feb 2014, 06:13 AM
Anyone?
0
Jerome
Top achievements
Rank 1
answered on 15 Feb 2014, 04:13 AM
I am having the same issue and hope that someone has an answer. It's seems to me that this may be an oversight on behalf of Telerik. This seems to be an obvious question that should have an answer. Lets hope someone can come up with a solution. I am all ears.
0
Dimitrina
Telerik team
answered on 17 Feb 2014, 09:54 AM
Hi,

You can try creating a QueryableCollectionView based on the SourceCollection bound to RadGridView
and then apply the same FilterDescriptors for it as for RadGridView.

For example:
QueryableCollectionView view = new QueryableCollectionView(permissionsGrid.ItemsSource as ObservableCollection<Club>);

foreach (var desc in this.permissionsGrid.FilterDescriptors)
{
    view.FilterDescriptors.Add(desc);
    Debug.WriteLine(view.ItemCount);
}

You can also directly use the SourceCollection of RadDataPager:
QueryableCollectionView view = new QueryableCollectionView((radDataPager.PagedSource as DataItemCollection).SourceCollection);

or the SourceCollection itself:
QueryableCollectionView view = new QueryableCollectionView(model.Clubs);

The view will hold the filtered items that way.

I hope this helps.

Regards,
Didie
Telerik

Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).

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