DataSource sync() order of execution for CRUD operations

5 posts, 0 answers
  1. Alexander
    Alexander avatar
    1 posts
    Member since:
    Mar 2015

    Posted 18 Mar 2015 Link to this post

    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.
  2. Atanas Korchev
    Atanas Korchev avatar
    8462 posts

    Posted 20 Mar 2015 Link to this post


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

    Atanas Korchev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Salim
    Salim avatar
    61 posts
    Member since:
    Jun 2016

    Posted 24 Aug 2016 in reply to Atanas Korchev Link to this post

    I completly agree with Alexander. Was something done regarding the order of the Create, Update, Destroy?
  4. Stephen
    Stephen avatar
    89 posts
    Member since:
    Jan 2011

    Posted 25 Aug 2016 in reply to Salim Link to this post

    I stopped using the built-in sync() a while ago and submit all my grids with a variation of this technique:


    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.

  5. Salim
    Salim avatar
    61 posts
    Member since:
    Jun 2016

    Posted 25 Aug 2016 in reply to Stephen Link to this post

    This is what I did also. I used the submit event
Back to Top