Unplanned
Last Updated: 21 Jan 2025 20:23 by Mac
Humayoon
Created on: 04 Apr 2023 14:14
Category: UI for Blazor
Type: Feature Request
14
blazor Grid Grouping Expand/Collapse All

Hi,

I would like to have a Expand/Collapse All Grid Groups button in the Grid Header. I know this is possible to do so programmatically outside of the grid but my users want it inside the Grid. 

Thanks,

Humayoon

1 comment
Mac
Posted on: 21 Jan 2025 20:23

using version 6.2
I have a button. If my items are already grouped, I can do the following: 
```

private async Task ExpandCollapse()
{
_isExpanded = !_isExpanded;
var state = _grid.GetState();

if (_isExpanded)
{
state.CollapsedGroups = null;
state.ExpandedItems = _alerts;
}
else
{
state.CollapsedGroups = Enumerable.Range(0, _items.ToList().Count).ToList();
}

await _grid.SetStateAsync(state);

}