DataGrid doesnt show empty message with empty Data #896

Open
opened 2026-01-29 17:45:58 +00:00 by claunia · 0 comments
Owner

Originally created by @0xor1 on GitHub (Jun 18, 2023).

Describe the bug
I have DataGrid passing in parameters:

<RadzenDataGrid
        @ref="_grid"
        Count="Count"
        Data="Items"
        TItem="Project"
        IsLoading="_isLoading"
        EmptyText="@L.S(S.OrgNoProjects)"
        RowClick="RowClick"
        FilterPopupRenderMode="PopupRenderMode.OnDemand" 
        FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
        AllowSorting="true" 
        AllowFiltering="true"
        LoadData="LoadData"
        KeyProperty="Id"
        class="row-clickable"
        Style="@($"width: {GridWidth}")">

When Items is empty and Count is defined Count => Items.Count the data grid does not show the empty message text. I have to add parameter AllowPaging="true" in order to get the Empty message to appear. This appears to be due to this logic here:

if (!this.ShowEmptyMessage || this.Count > 0 && (this.IsVirtualizationAllowed() ? (this.Data.Any<TItem>() ? 1 : 0) : 1) != 0 || !this.AllowPaging && this.LoadData.HasDelegate && this.Count == 0)
        {
          if (this.columns.Count > 0)
            __builder.AddContent(445, this.DrawRows((IList<RadzenDataGridColumn<TItem>>) list));
        }

this this.LoadData.HasDelegate && this.Count == 0 is true but Im not sure why I need to have AllowPaging=true also, Im not sure why paging should be required to show the empty message if an empty message is defined and the LoadData delegate and Count parameters are set and Count is 0;

Originally created by @0xor1 on GitHub (Jun 18, 2023). **Describe the bug** I have DataGrid passing in parameters: ``` <RadzenDataGrid @ref="_grid" Count="Count" Data="Items" TItem="Project" IsLoading="_isLoading" EmptyText="@L.S(S.OrgNoProjects)" RowClick="RowClick" FilterPopupRenderMode="PopupRenderMode.OnDemand" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" AllowSorting="true" AllowFiltering="true" LoadData="LoadData" KeyProperty="Id" class="row-clickable" Style="@($"width: {GridWidth}")"> ``` When `Items` is empty and Count is defined `Count => Items.Count` the data grid does not show the empty message text. I have to add parameter `AllowPaging="true"` in order to get the Empty message to appear. This appears to be due to this logic here: ``` if (!this.ShowEmptyMessage || this.Count > 0 && (this.IsVirtualizationAllowed() ? (this.Data.Any<TItem>() ? 1 : 0) : 1) != 0 || !this.AllowPaging && this.LoadData.HasDelegate && this.Count == 0) { if (this.columns.Count > 0) __builder.AddContent(445, this.DrawRows((IList<RadzenDataGridColumn<TItem>>) list)); } ``` this ` this.LoadData.HasDelegate && this.Count == 0` is true but Im not sure why I need to have `AllowPaging=true` also, Im not sure why paging should be required to show the empty message if an empty message is defined and the LoadData delegate and Count parameters are set and Count is 0;
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#896