Unplanned
Last Updated: 12 Sep 2024 01:44 by Federico
Igor
Created on: 29 Jun 2021 12:34
Category: Grid
Type: Feature Request
28
Persist Groups Collapsed/Expanded State

In a grouped Grid with Incell editing if I collapse all groups and then expand one to edit an item in it, once I press Enter to complete the editing all groups expand.

Please add option for persisting the Collapsed State of the groups.

---

ADMIN EDIT

---

The feature applies to the other data operations as well (for example, paging, sorting).
3 comments
Federico
Posted on: 12 Sep 2024 01:44

I found a workaround to this issue.

First I have a TelerikGrid reference in my code behind and a property to store the grid state (which includes grouping and collapsed groups):

private TelerikGrid<RiskRegister>? RiskRegisterGridEl { get; set; }

private GridState<RiskRegister>? GridState {  get; set; }

 

When the OnUpdate event callback of the TelerikGrid is fired, I save the grid state:

GridState = RiskRegisterGridEl?.GetState();

 

Then, I added a listener to the OnStateChanged event callback of the TelerikGrid. This event is fired for multiple reasons, so I only target the "EditItem" scenario. At that point, I re-set the grid state using the previously saved one. This is the method fired OnStateChanged:

private async Task OnGridStateChanged(GridStateEventArgs<RiskRegister> args)
{
    if (args.PropertyName == "EditItem" && RiskRegisterGridEl != null)
    {
        await RiskRegisterGridEl.SetStateAsync(GridState);
    }
}

 

There is one downside to this. On saving the row, the grid will quickly expand all groups and then go back to the desired state.

 

Hope this helps

 

Vladimir
Posted on: 13 Aug 2024 05:33

Another example is here

https://blazorrepl.telerik.com/QSOCkMbc32QeyZov07

Group by any column, collapse some groups and click Add or Remove button.

Hien
Posted on: 12 Jan 2022 22:53

I strongly suggest Telerik would look into implementing this on their next release. Without this, Grid functionality is incomplete. 

Hien