Declined
Last Updated: 01 Oct 2019 10:05 by ADMIN
Tom
Created on: 05 Sep 2019 06:37
Category: Grid
Type: Bug Report
0
New row not saved if Add button pressed again - inconsistent behaviour

Telerik Blazor version 1.5.0 Trial

Steps to reproduce:

  1. Open a page with a grid in incell edit mode, e.g. https://demos.telerik.com/blazor-ui/grid/editing-incell
  2. Put the cursor in the Name field of the first row and edit the just the Name field, do not click out of the cell or cause it to lose focus, do not edit any other cells first
  3. Press the Add button
  4. The grid will update the dataset and the edit you made is shown in the grid
  5. Press the Add button
  6. Enter the all of the data for the row, but do not press the row's 'Update' button
  7. Press the Add button again
  8. The new data you added is lost

This behaviour is inconsistent as the user is required to press the Update button to save a new row, but not to save changes for an existing row.  Can the grid be made to retain the new row when the Add button is pressed (or can we have that option)?

I think the base issue here is that the new row isn't added automatically when the cell/row loses focus.  The same issue therefore occurs if you press one of the page buttons at the bottom of the grid at step 3 instead.

 

 

5 comments
ADMIN
Marin Bratanov
Posted on: 01 Oct 2019 10:05

At the moment, this behavior is expected in the InCell editing mode. To get the desired behavior, please Follow the Batch Editing feature: https://feedback.telerik.com/blazor/1428492-batch-editing. I am now closing this item to avoid confusion in the future.

 

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor
ADMIN
Marin Bratanov
Posted on: 06 Sep 2019 10:14

Hi again Tom,

Another request for batch editing just came in and I made the following page where you can Follow it (I've already added your vote): https://feedback.telerik.com/blazor/1428492-batch-editing.

 

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor
ADMIN
Marin Bratanov
Posted on: 06 Sep 2019 08:01

Hello Tom,

I am not sure if the *first* blur can be captured like this (probably could be, through a private flag inside the grid), but I think that what you need is real batch editing rather than in-cell editing, so the grid would keep the new records and alterations for you and a Save toolbar button would give you a handler with all changes.

That said, you can use a custom toolbar button and observable data to add a blank item at the top of the grid, so the user can edit it by clicking in it. The only downside here is that there is no provision in Blazor for default focus (at least I am not aware of one, and the grid definitely does not have one yet).

On firing Create when Add is clicked - that was the initial way we had it before 0.5.0 or before 1.0.0, but that was actually pretty inconsistent with the other events, and it also did not leave room for an actual Create event. The grid needs to have similar and logical behavior in all its three current edit modes, because they share the same events and concepts.

With all this in mind, if you want such behavior, I advise you do it with a custom toolbar button and observable data at the moment, and wait for actual batch editing feature.

I'm looking forward to your thoughts on this, because I may be missing something, and I am speaking mostly from a perspective of the grid component and not of the perspective of a real business app.

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor
Tom
Posted on: 05 Sep 2019 14:12

Hi Marin

In an ideal world I guess the Create event would be triggered on blur and/or lost focus for the first cell where the value has been changed, but I suspect that's not possible in Blazor (or probably isn't consistent).

I think in our case adding the empty row on press of the Add button would be fine.  The user made a positive choice to add the row and there's a delete button if they decide they no longer want the record.  

We have a state object that the grid is adding to, so the records aren't persisted until a Submit button on the parent component is pressed, so nothing is really getting polluted at that stage.  We'd probably also add some guard code in the save event for page that dropped any rows that were still set to the default values so we don't end up with empty rows.

To my mind that's a cleaner user experience (especially if we could get rid of the row's Save button altogether).

But... I'm working with server side blazer, the above scenario probably possibly doesn't work as well with clientside Blazor as the record would already have been persisted.

Would it be massively difficult to allow the option of having the Create event fire after pressing the Add button?

ADMIN
Marin Bratanov
Posted on: 05 Sep 2019 13:15

Hello Tom,

How would you imagine a new row to be committed with InCell editing without the Save command button? Firing the Create event upon clicking Add instead of Save would certainly result in an empty model being added to the data source, which is not acceptable, as it would pollute the data source. On the other hand, clicking the Add button is expected to add a new, blank model to the grid.

With this in mind, if you are looking for an in-cell type of experience, I'd encourage you to wait for an implementation of actual batch editing. Or, as I suggested in your forum thread, handle inserts separately outside the grid, so you can remove the Update button.

Another thing you can consider is to cancel the OnClick event of the Add button based on a condition (for example, the Update event has not fired since the last time Add or Cancel was clicked).

I am looking forward to your thoughts on this matter, so we can discuss whether a viable built-in option for this exists.

 

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor