diff --git a/RadzenBlazorDemos/Pages/DataGridInCellEdit.razor b/RadzenBlazorDemos/Pages/DataGridInCellEdit.razor index d026950ce..fbcfa4cf7 100644 --- a/RadzenBlazorDemos/Pages/DataGridInCellEdit.razor +++ b/RadzenBlazorDemos/Pages/DataGridInCellEdit.razor @@ -168,13 +168,12 @@ ColumnWidth="200px" CellClick="@OnCellClick"> /// async Task OnCellClick(DataGridCellMouseEventArgs args) { - if (!grid.IsValid || + if (!grid.IsValid || (ordersToUpdate.Contains(args.Data) && columnEditing == args.Column.Property)) return; - // Record the previous edited field, if you're not using IRevertibleChangeTracking to track object changes + // Commit any pending edit before switching to the new cell. if (ordersToUpdate.Any()) { - editedFields.Add(new(ordersToUpdate.First().OrderID, columnEditing)); await Update(); } @@ -205,6 +204,8 @@ ColumnWidth="200px" CellClick="@OnCellClick"> if (ordersToUpdate.Any()) { + // Record the edited field so the cell gets the "edited" indicator. + editedFields.Add(new(ordersToUpdate.First().OrderID, columnEditing)); await grid.UpdateRow(ordersToUpdate.First()); } } diff --git a/RadzenBlazorDemos/Pages/GanttInCellEdit.razor b/RadzenBlazorDemos/Pages/GanttInCellEdit.razor index 21e15f19e..fefea4117 100644 --- a/RadzenBlazorDemos/Pages/GanttInCellEdit.razor +++ b/RadzenBlazorDemos/Pages/GanttInCellEdit.razor @@ -141,7 +141,6 @@ if (tasksToUpdate.Any()) { - editedFields.Add(new(tasksToUpdate.First().Id, columnEditing)); await Update(); } @@ -169,6 +168,7 @@ if (tasksToUpdate.Any()) { + editedFields.Add(new(tasksToUpdate.First().Id, columnEditing)); await gantt.UpdateRow(tasksToUpdate.First()); } }