Declined
Last Updated: 16 Dec 2021 14:03 by Alan
Alan
Created on: 07 Dec 2021 15:48
Category: Grid
Type: Bug Report
0
Row Virtualization and Load Groups on Demand Ignore PageSize Value

Documentation states that Grid supports Virtualization with Grouping if it is done by loading the Groups on-demand.

See:



On page: Blazor Grid - Load Group Data On Demand | Telerik UI for Blazor

From this, it appears that Virtual Scrolling, Group Load on Demand, and pagination of the results should function as expected.  I'm specifically focusing on the section where it says "load on demand for the data when the user expands a group or when they scroll to need a new set of available groups".

The behavior I am seeing in my Telerik Repl is not matching up with that.

See:  https://blazorrepl.telerik.com/QFbmurvT41eZq6Ld34

 

In the repl, I have added some Console.WriteLines to see when OnRead is actually called, as well as to log out some other information about the OnRead Request.  It can be seen that no pagination information is included in the request (PageSize = 0, Skip = 0) while the PageSize is set on the actual Grid component (PageSize = 20).

 

As a result, all groups are loaded initially, which will be problematic if my server-side data set is being grouped on a value that will result in thousands/millions of groups.

 

It is possible that I missed something in the documentation that would enable the expected behavior (the Grid actually giving me PageSize and Skip so pagination will actually work), but it is also equally possible that this was never intended behavior, and I have been misled by the documentation page.

4 comments
Alan
Posted on: 16 Dec 2021 14:03
Looks great to me.  Thanks!
ADMIN
Dimo
Posted on: 16 Dec 2021 08:09

Hi Alan,

Thanks for your feedback. I reworded the Load on Demand article a bit. Please confirm if the new content on lines 28, 47 and 54 reflects your suggestion and prevents misunderstanding:

Once grouping is applied (either manually by the user, or through the Grid [state]), the groups will now show up collapsed by default. When the user expands a group, all its rows will be requested from the data source. If you provide all the `Data` to the Grid, the component will perform the operations for you. For details about server operations, see below.

...

While grouping is active, paging and virtual scrolling operations do not trigger `OnRead`, because the Grid already has all the group headers and all the items from the currently expanded groups.

...

... mimics an actual data service to implement load on demand when the user expands a group. No requests are made during scrolling. The `PageSize` determines the number of rendered rows, but not the number of expected rows in data requests. The example also shows how to set the initial Grid state to include grouping.

Regards,
Dimo
Progress Telerik

Learn about the important changes coming in UI for Blazor 3.0 in January 2022!
Alan
Posted on: 14 Dec 2021 13:46

Dimo,

I think this behavior is to be expected, according to the documentation you quoted, but it still stands that there are two contradicting pieces of documentation out there.  Suggestion from me would be to update the documentation that I included in my original post so that it reflects the actual behavior of the grid.

ADMIN
Dimo
Posted on: 14 Dec 2021 09:43

Hello Alan,

Your observations are correct and the Grid Load Groups on Demand documentation confirms it:

If the currently expanded group row does not have subgroups  ... The PageSize of that request is set to 0 so the grid gets all items for that group. The OnRead event will fire every time you expand a group to get the items for that group.

When loading groups on demand, the Grid requests items on a per-group basis, regardless of the PageSize. In the same fashion, a lazy loaded TreeView expands a group with all its child items. There is no easy or performant way to request a particular number of groups and rows in a random page with a single request. To do that, you would need to know all of the data in the Grid in advance, which defeats the purpose of a LoadOnDemand approach.

After the Grid loads all items from a given group, then it pages within the group internally.

In general, using row virtualization with grouping requires a compromise and the described mechanism is the only way to support it. I hope I managed to explain the reasoning behind our design.

Regards,
Dimo
Progress Telerik

Learn about the important changes coming in UI for Blazor 3.0 in January 2022!