Grouped & Paginated GridView Self reference ChildTableDefinition

2 posts, 0 answers
  1. Josue Yeray
    Josue Yeray avatar
    1 posts
    Member since:
    Oct 2011

    Posted 19 May 2015 Link to this post

    Hi!

    I Have a GridView loaded with 2000 records, grouped by one column and paginated using the RadDataPager.

    To make the grouping and pagination work, i needed to use a PagingBeforeGroupingQueryableCollectionView. With a standard Collection the paging was not working correctly as it counts the groups per page and not total items per page:

    public class PagingBeforeGroupingQueryableCollectionView : QueryableCollectionView
    {
        public PagingBeforeGroupingQueryableCollectionView(IEnumerable source)
            : base(source)
        {
        }
     
        protected override IQueryable CreateView()
        {
            if (this.TotalItemCount == 0)
            {
                return this.ApplySelectDescriptors(this.QueryableSourceCollection);
            }
            else
            {
                var queryable = this.QueryableSourceCollection;
                queryable = queryable.Where(this.FilterDescriptors);
                queryable = this.Sort(queryable);
                queryable = this.ApplySelectDescriptors(queryable);
                queryable = queryable.Page(this.PageIndex, this.PageSize);
                queryable = queryable.GroupBy(this.GroupDescriptors);
     
                return queryable;
            }
        }
     
        protected override int GetPagingDeterminativeItemCount()
        {
            return this.QueryableSourceCollection.Where(this.FilterDescriptors).Count();
        }
    }

    Now, i need to add Hierarchical data, so i defined a ChildTableDefinitions. In the DataLoading event of GridView it detects correctly the parentrows and allows me to define the columns for the child gridview, even in the row loaded event i can check what rows have childs to show the expandable buttons on them. All this works pretty well but when i expand one row with childs, the child gridview is showed without data. If i remove the grouping column and the child data is in the same page as the parent row, i can see the child rows. If the child rows are in another page, i can't see them. If i remove both grouping and paging, all works perfectly, showing the child data for every parent row. But as soon as i group the data again, even without pagination, the child gridview don't show any data.

    Is there a way we can have Grouping, paging and child data working in the same GridView, independently of the page of the data?

     Kind regards,

  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 21 May 2015 Link to this post

    Hi,

    You mention you populate the child hierarchy in row loaded event. Generally, we do not recommend working with the visual elements in RadGridView (i.e. GridViewCell, GridViewRow) as it is a virtualized control and its elements are reused as they are brought in and out the view area. You can also check our online documentation explaining how the UI virtualization works. 

    As to the grouping functionality, it seems you have followed the "Paging before Grouping" WPF Demo, is this correct? Then, you only experience issues with introducing a hierarchy. As it turns out we are not aware of issues related to hierarchy specifically, would you also try Row Details option to define hierarchy data?

    In case the issue still persists, may I ask you to try isolating the issue in a demo project illustrating your setup? You can also take a look at this blog post for a reference on how to isolate an issue. 
    You can open a new support ticket under the respective product category and send the solution there.


    Regards,
    Dimitrina
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top