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

DataSource sync() order of execution for CRUD operations

4 Answers 157 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Alexander asked on 18 Mar 2015, 03:11 PM
I noticed that datasource sync() method always executes synchronization operations in the following order: Create, Update, Destroy.
It may cause a problem in some cases. Consider a situation, when we have some list of items with requirement that every item must be unique in the list and datasource have autoSync: false. The list contains item A already. We delete item A, then create the same item A and trying to sync() datasource. At one point the list will contain two A items, because kendo always executes Create before Destroy and I cannot find the way how to change this order from my code.

4 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 20 Mar 2015, 07:00 AM
Hello,

This is by design and cannot be changed at this point.

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Salim
Top achievements
Rank 1
answered on 24 Aug 2016, 06:48 AM
I completly agree with Alexander. Was something done regarding the order of the Create, Update, Destroy?
0
Stephen
Top achievements
Rank 2
answered on 25 Aug 2016, 12:37 PM

I stopped using the built-in sync() a while ago and submit all my grids with a variation of this technique: http://www.telerik.com/support/code-library/save-all-changes-with-one-request

 

This way, you have complete control of the order of the save, can validate across the entire resulting dataset(i.e. no duplicate rows), can have the create/update/delete inside a single DB transaction, etc.

0
Salim
Top achievements
Rank 1
answered on 25 Aug 2016, 01:19 PM
This is what I did also. I used the submit event
Tags
Data Source
Asked by
Alexander
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Salim
Top achievements
Rank 1
Stephen
Top achievements
Rank 2
Share this question
or