radzenhq / radzen-blazor

Radzen Blazor is a set of 90+ free native Blazor UI components packed with DataGrid, Scheduler, Charts and robust theming including Material design and FluentUI.
https://www.radzen.com
MIT License
3.42k stars 763 forks source link

DataGrid add new row issue with LoadData method #365

Open s-dezign opened 2 years ago

s-dezign commented 2 years ago

In DataGrid, which is using LoadData method, when you filter out all data and nothing found row showing up. In this case if you will try to add new row, it will never show up. This is only happens in nothing found case.

To Reproduce Steps to reproduce the behavior:

  1. Open page with DataGrid (which is using Inline Editing and LoadData important method)
  2. Apply a filter on one of the columns so nothing will be found
  3. Try to add new record (row)
  4. See that new row didn't appear

Expected behavior New row should show up instead of nothing found

Once Again This is not happens when only Data is using. ONLY when LoadData is using.

Example which causing that bug

<RadzenDataGrid
    @ref="@Grid"
    Style="height: calc(100vh - 149px)"
    AllowFiltering="true"
    FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
    AllowColumnResize="true"
    FilterMode="FilterMode.Advanced"
    AllowPaging="true"
    PageSizeOptions="@PageSizeOptions"
    PageSize="@DefaultPageSize"
    AllowSorting="true"
    IsLoading="@IsLoading"
    LoadData="@LoadData"
    Data="@Data"
    Count="@Count"
    RowCreate="@AddRow"
    RowUpdate="@UpdateRow"
    TItem="DataModel"
    EditMode="DataGridEditMode.Multiple"
    LogicalFilterOperator="LogicalFilterOperator.And">
enchev commented 2 years ago

Hey @s-dezign, There is indeed problem with InsertRow() method when the DataGrid is bound using LoadData. The only workaround we can offer is to insert new item in the collection assigned to Data property instead. You can check also the code generated by Radzen inline edit page template for reference.

s-dezign commented 2 years ago

@enchev do you have that code generated by Radzen by any chance ?

s-dezign commented 2 years ago

@enchev it is still doesn't work. I did add new item into Data instead of InsertRow(), but first it is causing issue when you cancel Editing new row and second it doesn't resolve issue when No records to display message new row is not appear.

raysefo commented 2 years ago

I am dealing with the same issue.

clinically-au commented 1 year ago

This appears to be an ongoing issue, and it affects the scaffolded code from the current version of Blazor Studio. Is there any documented way to resolve this?

OndrejUzovic commented 1 year ago

Any plans to resolve this issue?

XorZy commented 11 months ago

I have encountered this issue as well. I am using the following workaround: before calling InsertRow() I set ShowEmptyMessage to false and it seems to bypass the problem.