This is a migrated thread and some comments may be shown as answers.

Dirty rows after partial create/update/delete action success in inline cell / batch editing

4 Answers 736 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kaan
Top achievements
Rank 1
Kaan asked on 10 Jan 2017, 10:03 AM

Hello!

I am having the following problem: If at least one simultaneously fired create/update/delete fails, Kendo grid keeps the dirty attribute even for the successfully executed create/update/delete operations. This leads to an inconsistent state between the client and the database on the server.

I am providing an isolated example of the problem. Therefore I have modified an official Kendo example by only setting the URL of the update service to a non-existing one: http://dojo.telerik.com/ohAle

Please do the following steps to reproduce the problem:

1. Click (at least one time) on "Add new record"
2. Edit (at least one) an existing record
3. Click on "Save changes": One create and one update request will be fired (see network tab of browser developer tools)
4. The create request will be successful, but the update request will fail (because of wrong URL)
5. Click again on "Save changes": Update request will be fired again, but create request too although it was successful the last time (because of dirty states)
6. You can repeat step five as often as you like. When you restart the example, you will see that all the before create requests where successful

In our project we also integrated the feature to preserve the dirty indicators, which also makes it possible for the user to see the above described problem visually, but it's not important for the isolated example to reproduce the problem: http://docs.telerik.com/kendo-ui/controls/data-management/grid/how-to/Editing/preserve-the-dirty-indicator-in-incell-editing-and-client-operations

I feel like the Kendo grid should be able to handle the success of simultaneously fired create/update/delete requests independently out of the box because this is a very common scenario. However, I found a possible workaround (http://docs.telerik.com/kendo-ui/controls/data-management/grid/how-to/Editing/sync-grid-changes-with-single-request), but this would require a lot of additional coding on the client and server.

Thank you in advance for your support.

 

Best regards,

Kaan

4 Answers, 1 is accepted

Sort by
0
Dimiter Topalov
Telerik team
answered on 12 Jan 2017, 08:35 AM
Hello Kaan,

You are making a valid point. This is a known limitation of the batch functionality. The problem is that there is no trivial way to distinguish between the failed, and passed requests, and which exactly has failed, and therefore the whole sync operation fails, but at the same time the successful requests make the respective changes on the server.

The alternatives to the solution, provided in the how-to article you have mentioned, are to either not use batch mode (you can also set autoSync to true to sync changes as they happen), or to handle the dataSource requestEnd event, and apply some custom logic to loop through the data items, and manipulate them as necessary.

I am sorry for any inconvenience this might cause, and thank you for the understanding.

Regards,
Dimiter Topalov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Shannon
Top achievements
Rank 2
answered on 31 May 2018, 03:57 AM
I am dealing with the same issue and I find it very frustrating that in a year and a half there has been no improvement on this situation.  This makes batch mode useless.  I don't understand how Telerik can put forward such a flawed item and offer no solution.  Please show me an example of how to keep from endlessly creating new records while in batch mode or some solution for this.  I have tried the AutoSync solution but that doesn't fire when in Batch mode.
0
Pavlina
Telerik team
answered on 01 Jun 2018, 04:14 PM
Hi,

Together with the developers we will check this limitation once again and see if we can provide a fix or a workaround for it. Once I have more information on the subject I will let you know.

Thank you for your understanding.
 
Regards,
Pavlina
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Pavlina
Telerik team
answered on 07 Jun 2018, 09:34 AM
Hi,

I have discussed the case with our developers and they confirmed that the observed behavior is expected with the current implementation of the DataSource. When calling the sync() method on the DataSource, each of the respective actions will be called (create, update, destroy). The call will be resolved with success if all requests have finished successfully, or rejected if any single request fails.

In the discussed case from the first post, the update request fails. Therefore, the DataSource considers that the entire sync has failed and does not take into account any changes made on the remote. This results in difference between the state of the remote data and the DataSource data. In order to avoid such case, both the create and update calls should be executed within a single request. This could be achieved by configuring the transport.submit option of the DataSource. 

For sample configuration, check the documentation at:
https://docs.telerik.com/kendo-ui/api/javascript/data/datasource/configuration/transport.submit

Regards,
Pavlina
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Kaan
Top achievements
Rank 1
Answers by
Dimiter Topalov
Telerik team
Shannon
Top achievements
Rank 2
Pavlina
Telerik team
Share this question
or