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

Grouped & Paginated GridView Self reference ChildTableDefinition

1 Answer 55 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Josue Yeray
Top achievements
Rank 1
Josue Yeray asked on 19 May 2015, 08:31 AM

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,

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 21 May 2015, 12:01 PM
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
Tags
GridView
Asked by
Josue Yeray
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or