DataGrid self-Reference hierarchy not showing "Childs"

Greetings,
I'm facing a problem using DataGrid self-Reference hierarchy

The issue is that the "Parents" are correctly shown, but the "Childs" are not displayed even though args.Data has the correct data.

Am I doing something wrong?

<RadzenDataGrid @ref="modulesGrid"
                Data="@modulesList"
                RowRender="@RowRender"
                LoadChildData="LoadChildData"
                TItem="AuthorizationProfileModel"
                RowCollapse="@(args => modulesGrid.ColumnsCollection.ToList().ForEach(c => c.ClearFilters()))">
    <Columns>
        <RadzenDataGridColumn Width="300px">
            <Template Context="data">
                @data.ModuleName
            </Template>
        </RadzenDataGridColumn>
    </Columns>
</RadzenDataGrid>
IEnumerable<AuthorizationProfileModel>? modulesList;
RadzenDataGrid<AuthorizationProfileModel> modulesGrid;

*filling moduleslist*

 async void RowRender(RowRenderEventArgs<AuthorizationProfileModel> args)
 {
     args.Expandable = (await AuthorizationProfilesFactory.GetLoginPermissions(dbAccess, selectedUser.LoginEmail, $"{args.Data.Module}_1")).ToList().Any();
 }

 async void LoadChildData(DataGridLoadChildDataEventArgs<AuthorizationProfileModel> args)
 {
     args.Data = await AuthorizationProfilesFactory.GetLoginPermissions(dbAccess, selectedUser.LoginEmail, $"{args.Item.Module}_1");
}

Best Regards,
PH

Please post runnable code where we can replicate the problem - use our demos, they are editable.

Hello again,
Here you have some runable code I tried to make it as minimal as I could, this will run in the Radzen Demos, my issue is that even if the args.Data has Data (as shown in the screenshot below) it never shows it
The result I get is as if I commented

  //args.Data = dbContext.Employees.Where(e => e.ReportsTo == args.Item.EmployeeID);

args.Data

@using RadzenBlazorDemos.Data
@using RadzenBlazorDemos.Models.Northwind
@using Microsoft.EntityFrameworkCore

@inherits DbContextPage

<RadzenDataGrid @ref="grid" 
                Data="@employees" 
                LoadChildData="@LoadChildData" 
                TItem="Employee">
    <Columns>
        <RadzenDataGridColumn Width="300px">
            <Template Context="data">
                <strong>@data.TitleOfCourtesy @data.FirstName @data.LastName</strong>
            </Template>
        </RadzenDataGridColumn>
    </Columns>
</RadzenDataGrid>

@code {
    IEnumerable<Employee> employees;
    RadzenDataGrid<Employee> grid;

    protected override async Task OnInitializedAsync()
    {
        await base.OnInitializedAsync();
        employees = dbContext.Employees.Where(e => e.ReportsTo == null);
    }
  
    void LoadChildData(DataGridLoadChildDataEventArgs<Employee> args)
    {
        args.Data = dbContext.Employees.Where(e => e.ReportsTo == args.Item.EmployeeID);
    }
}

Thank you for your help
Best Regards

Most probably this is causing the problem - use async Task instead.

That was indeed the issue
Thank you for your help :slight_smile: