Events fired in a DataGrid cause it to empty itself

Hi!
Binding a RowClick event to a Datagrid (or any mouse event to any button inside it) causes it to empty the datagrid when fired. In this particular case, clicking any row causes the datagrid to empty itself thoroughly, even though the eventHandler is just a Console.WriteLine .

<RadzenDataGrid Style="cursor: pointer;" id="control_room_datagrid" @ref="grid" IsLoading=@isLoading Count="@count" Data="@fileScenarios" AllowColumnResize="true" AllowSorting="true" AllowFiltering="true" AllowPaging="true" PageSize="11" PagerHorizontalAlign="HorizontalAlign.Center" TItem="FileScenario" RowClick="() => Console.WriteLine('a')">
    <Columns>
        <RadzenDataGridColumn TItem="FileScenario" Title="Client" Property="Client.Name" />
        <RadzenDataGridColumn TItem="FileScenario" Title="Tenant" Property="Tenant.Name" />
        <RadzenDataGridColumn TItem="FileScenario" Title="Nom" Property="FileName" />
        <RadzenDataGridColumn TItem="FileScenario" Title="Description " Property="Description" />
        <RadzenDataGridColumn TItem="FileScenario" Title="Date de modification " Property="ModificationDate" />
        <RadzenDataGridColumn TItem="FileScenario" Title="Date de création" Property="CreationDate" />
        <RadzenDataGridColumn TItem="FileScenario" Title="Nombre de documents" Property="DocumentNumber" />
        <RadzenDataGridColumn TItem="FileScenario" Title="Actions" Sortable="false">
            <Template>
                @{
                    string jsonContext = JsonSerializer.Serialize(context);
                }
                <div class="action_div" data-scenario="@jsonContext">
                    <button class="btn btn-primary" onclick="downloadScenario(this, event)">
                        <i class="bi bi-download"></i>
                    </button>
                    <button class="btn btn-warning" data-bs-toggle="modal" data-bs-target="#modalDeleteScenario" onclick="fillModalDelete(this, event)">
                        <i class="bi bi-trash3-fill"></i>
                    </button>
                </div>
               
            </Template>
        </RadzenDataGridColumn>
    </Columns>
</RadzenDataGrid>

Not sure what you mean with empty itself. There are plenty of DataGrid examples with events in our demos where everything works as expected.

Woh! Impressed with the fast answer!

Well, I mean that there is no data any more in the datagrid. Here is a gif of the issue. I recognize that the examples work fine on your website though.

Thanks a lot,
Eloi
chrome_PSYEQRe2M8

Try to debug your app - something sets the variable assigned to Data to null/empty collection.

Thanks for the advice. The problem doesn't seem that Data was set to null, but rather than Count was set to null. So my bad. Still, it might be a good idea to "fail safe" in that case, by not displaying the number of rows, instead of showing no data at all.

Thanks anyway and have a nice day,

Eloi

If you are not using LoadData you do not need to set Count at all.