Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Mudblazor MudDataGrid HierarchyColumn expand all rows

$
0
0

I am using MubBlazor

6.11.0

I want to Have a HierarchyColumn that is expanded when the user clicks the Expand all button or by default, is there a way to do this? Having GroupExpanded="true" only seems to work for Grouped columns and not just from HierarchyColumns

@using System.Net.Http.Json@using MudBlazor.Examples.Data.Models@inject HttpClient httpClient<MudDataGrid  @ref="dataGrid" Items="@Elements"             GroupExpanded="true"><Columns><HierarchyColumn T="Element" /><PropertyColumn Property="x => x.Number" Title="Nr" /></Columns><ChildRowContent><MudCard><MudCardContent><MudText>This element is number @context.Item.Number</MudText></MudCardContent></MudCard></ChildRowContent><PagerContent><MudDataGridPager T="Element" /></PagerContent></MudDataGrid><div class="d-flex flex-wrap mt-4"><MudButton OnClick="@ExpandAllGroups" Color="@Color.Primary">Expand All</MudButton><MudButton OnClick="@CollapseAllGroups" Color="@Color.Primary">Collapse All</MudButton></div>@code {     private IEnumerable<Element> Elements = new List<Element>();    MudDataGrid<Element> dataGrid;    protected override async Task OnInitializedAsync()    {        Elements = await httpClient.GetFromJsonAsync<List<Element>>("webapi/periodictable");    }  void ExpandAllGroups()    {        dataGrid?.ExpandAllGroups();    }        void CollapseAllGroups()    {        dataGrid?.CollapseAllGroups();    }}

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>