RadzenDataGrid - No records to display

Hello, there is an issue with the follwoing code, I can't understand.

If I run the code below, the RadzenDataGrid will show 'No records to display'. But the line <div>Kunde: @customerList[0].LastName</div> shows the correct result.
If I move the allocation customerList = new(); after the await Wait(1000); command, the grid shows the correct result.

If I take the code like below and I replace the RadzenDataGrid through RadzenGrid and RadzenDataGridColumn through RadzenGridColumn, everything works like expected. The grid shows the data.

Is this a bug, or are I'm something missing?

@page "/Test"

<div>Counter: @counter.ToString()</div>

@if (customerList != null && customerList.Count() > 0)
{
    <div>Kunde: @customerList[0].LastName</div>
}

<RadzenDataGrid Data="@customerList" TItem="Customer">
    <Columns>
        <RadzenDataGridColumn TItem="Customer" Property="LastName" Title="Last Name" Width="250px" />
        <RadzenDataGridColumn TItem="Customer" Property="FirstName" Title="First Name" Width="150px" />
    </Columns>
</RadzenDataGrid>

@code{
    public List<Customer>? customerList;
    int counter = 0;
    Customer customer = new() { LastName = "Doe", FirstName = "John" };

    protected override async Task OnInitializedAsync()
    {
        await base.OnInitializedAsync();

        customerList = new();

        await Wait(1000);

        counter++;

        // If I do the allocation here, it works like intendet
        //customerList = new();
        customerList.Add(customer);
    }

    private async Task Wait(int millisec)
    {
        await System.Threading.Tasks.Task.Delay(millisec);
    }

    public class Customer
    {
        public string FirstName { get; set; } = "";
        public string LastName { get; set; } = "";
    }
}

DataGrid component will not listen to collection changes and will not know that you've added new data to this list (lists are not also INotifyCollectionChanged). You need to fill your data in a variable and assign it to the customerList - in this case Blazor will notify the DataGrid that Data property is changed and the grid will re-render.

Thank you for your response. But your suggestion doesn't solve the problem. If I remove the function call

await Wait(1000); from the source above (this leads to an synchronus execution of OnInitializedAsync), the grid shows the correct result. In this case, the DataGrid recognize the collection change.

The old RadzenGrid works in both scenarios, the RadzenDataGrid only in this last one. Other suggestions?

Nothing will listen that you are adding records to your collection after the DataGrid is initialized. Check my previous reply.