Need More Info
Last Updated: 07 Aug 2025 10:02 by ADMIN
Adil
Created on: 05 Aug 2025 18:57
Category: UI for Blazor
Type: Bug Report
0
Reexpanding the expanded rows automatically, like they were before Gridref.Rebind()
So i thought that 
gettting the state x
gridref.rebind()
setting new state x

would re-expand the row automatically - didnt work


added Equal and GetHashCode- still dont work


1 comment
ADMIN
Tsvetomir
Posted on: 07 Aug 2025 10:02

Hello Adil,

The issue you’re describing is common when dealing with Grid DetailTemplate expansion after state changes and data operations. Here are the key points and steps to ensure the DetailTemplate re-expands as expected:

1. Correct Sequence for State Restoration

  • Save the expanded items before rebinding or updating the Grid’s data.
  • After rebinding or data refresh, restore the expanded items and apply the state to the Grid.

2. Use SetStateAsync for Restoring Expanded Items

  • The recommended approach is to use the Grid’s SetStateAsync method after data is loaded and the expanded items are available. Here’s an example:
    var currentExpanded = state.ExpandedItems.ToList();
    await GridRef.Rebind();
    state.ExpandedItems = new List<Employee>(currentExpanded);
    await GridRef.SetStateAsync(state);

3. Ensure Data and Model Equality

  • After a data refresh, the references of the expanded items may change. It’s essential that your model’s Equals and GetHashCode methods are correctly overridden. The Grid uses these to match expanded items after rebind.
  • Double-check that the expanded items in state.ExpandedItems actually exist in the new data set after rebinding.

4. Data Loading Timing

  • If you are loading data asynchronously, ensure the data is fully loaded before restoring the expanded state. The Grid cannot expand items that do not exist in its current data.

5. Debugging

  • Add breakpoints or log the contents of state.ExpandedItems before and after SetState to confirm that the correct items are being tracked.

You can review a runnable example here: https://blazorrepl.telerik.com/mJkWYLus40nl3Z3y03

If you continue to have issues, please modify the above REPL example to reproduce the issue and send it back to me for inspection.

For now, I'm changing the status of the item to "Need More Info". Let me know how it goes.

Regards,
Tsvetomir
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.