Paging / Filtering / Aggregates

4 posts, 0 answers
  1. Randy
    Randy avatar
    50 posts
    Member since:
    Aug 2010

    Posted 12 Feb 2014 Link to this post

    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?
  2. Randy
    Randy avatar
    50 posts
    Member since:
    Aug 2010

    Posted 14 Feb 2014 in reply to Randy Link to this post

    Anyone?
  3. DevCraft banner
  4. Jerome
    Jerome avatar
    1 posts
    Member since:
    Feb 2014

    Posted 14 Feb 2014 Link to this post

    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.
  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 17 Feb 2014 Link to this post

    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).

Back to Top