Declined
Last Updated: 14 Nov 2023 12:18 by ADMIN
Kacper
Created on: 31 Oct 2023 13:02
Category: UI for Blazor
Type: Bug Report
0
duplicated OnRead method call - grid

Hi, 

During grid initialization I have duplicate OnReadMethod call. I dynmaically set LoadGroupsOnDemand parameter. When LoadGroupsOnDemand  is false and when I skip the second call (I shouldn't do any extra logic to calculate the call number anyway) it works fine. If LoadGroupsOnDemand is true I have to call it twice. With early ending of first call, second OnRender call won't be done. If I do "return" at the begining of second call it returns me an empty grid. 

Similar issue to this one: https://feedback.telerik.com/blazor/1442276-onread-called-twice-on-initialization

3 comments
ADMIN
Dimo
Posted on: 14 Nov 2023 12:18

Hello Kacper,

Can you send a REPL example (similar to mine), which reproduces the unexpected behavior?

Regards,
Dimo
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!
Kacper
Posted on: 14 Nov 2023 12:15

Hi Dimo,

In the case that I described, the problem is not in switching LoadGroupsOnDemand attribute, but double call of the OnRead method. Even when I have a constant LoadGroupsOnDemand value set to true, there is still double call to the OnRead method. Skipping first call doesn't help - the next call then doesn't occur.

ADMIN
Dimo
Posted on: 07 Nov 2023 07:27

Hi Kacper,

Here is how to Grid works:

  • If you change the value of LoadGroupsOnDemand while the Grid is not grouped, then there is no need for a new data request and OnRead event.
  • If you set LoadGroupsOnDemand while the Grid is grouped, you must Rebind() the Grid, because the new component configuration requires a different data structure. The rebinding will trigger the OnRead event.

Here is a REPL test page, which demonstrates the above.

If you are setting LoadGroupsOnDemand on initial load, then it is possible to avoid the two data requests if you:

  1. Use a boolean flag that shows if you have set the final value of LoadGroupsOnDemand.
  2. Abort the execution of the first OnRead event, depending on the boolean flag value.
  3. Set LoadGroupsOnDemand, reset the boolean flag and Rebind() the Grid.

In conclusion, the discussed Grid behavior is expected and I don't see a bug here. Still, let me know if I am missing something.

Regards,
Dimo
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!