[CLOSED] Store Sync order of operations

  1. #1

    [CLOSED] Store Sync order of operations

    Is there a way to change the order of operations for Store sync? I am using a store with an AjaxProxy. It looks like the process order is new records, updated records, then deleted records.

    I would think that you would want to first process deleted records then anything else.

    The example is:

    I delete a record in the Grid with the Name field of 'Microsoft', which is a unique constraint. Before syncing the store I add a new record with a name field of 'Microsoft'. Since the process order is New, Update, Delete the new record fails to insert, but then the deleted record is removed and I now have no 'Microsoft record.

    Just curious ...
    Last edited by Daniil; Nov 14, 2013 at 1:21 PM. Reason: [CLOSED]
  2. #2
    Hi Chris,

    Please use an AjaxProxy's BatchOrder.
    http://docs-origin.sencha.com/extjs/...cfg-batchOrder
  3. #3
    This works just like I want it. At least one other person asked about this.

    Store batch order

    It seems weird that the default is 'create,update,delete' instead of 'delete,update,create'.

    Please close.
  4. #4
    Let's try to opposite your scenario, this one:
    Quote Originally Posted by cwolcott View Post
    I delete a record in the Grid with the Name field of 'Microsoft', which is a unique constraint. Before syncing the store I add a new record with a name field of 'Microsoft'. Since the process order is New, Update, Delete the new record fails to insert, but then the deleted record is removed and I now have no 'Microsoft record.
    with your new batchOrder.

    So, "I create a record in the GridPanel with the Name field of 'Microsoft', which is a unique constraint. Before syncing the store I delete that record with a name field of 'Microsoft'. Since the process order is Delete, Update, Create the record is deleted, then created. Expected - no 'Microsoft' record', in fact - we have 'Microsoft' record."

    Does that make sense?
  5. #5
    Quote Originally Posted by Daniil View Post
    So, "I create a record in the GridPanel with the Name field of 'Microsoft', which is a unique constraint. Before syncing the store I delete that record with a name field of 'Microsoft'. Since the process order is Delete, Update, Create the record is deleted, then created. Expected - no 'Microsoft' record', in fact - we have 'Microsoft' record."

    Does that make sense?
    No I doesn't make sense, because the record will never be inserted into the database. Here are the steps:

    1) Create record in the GridPanel with the name field 'Microsoft'.
    The record exists in the store and is in the newRecords object.

    2) Before syncing the store I delete that record with the name field of 'Microsoft'.
    The record is removed from the store and is no longer in the newRecords object.

    3) Now we sync the store, but there are no changes.

    Does this make sense?
  6. #6
    Hmm.

    Do you mean IDProperty under "a unique constraint"?
  7. #7
    Quote Originally Posted by Daniil View Post
    Hmm.

    Do you mean IDProperty under "a unique constraint"?
    No. There is an ID column that is the IDProperty and is defined as an identity column in the database. The Name column is just a unique contraint in the database. So there should be only one row in the DB with 'Microsoft'. I currently do not perform any checks in the Grid when the data is added/edited. I let the StoreResponse return an exception if there is one.

    Again everything is working perfectly for me, once I reversed the BatchOrder. I could work up an example, but it couldn't be run because we would have no backend database.
  8. #8
    Quote Originally Posted by cwolcott View Post
    I could work up an example, but it couldn't be run because we would have no backend database.
    No need, thanks.

    Well, it makes sense what you are talking about.

    Though, maybe, there are other possible scenarios which proves the current default batchOrder. I mean that ExtJS mean somehow picked that order. Maybe, they were wrong, but, anyway, they provided an option to change the order. It looks good enough.

    I would prefer to leave this issue as it is for now if you don't mind. But I will keep it in mind.
  9. #9
    Please close the thread. I wasn't asking for anything to change and I am glad that they have an option for use to change the order to meet the developers needs.
  10. #10
    Quote Originally Posted by cwolcott View Post
    I wasn't asking for anything to change
    I am always craving to improve something by myself as well:)

Similar Threads

  1. Sync store problem
    By Spamme in forum 2.x Help
    Replies: 1
    Last Post: Apr 18, 2013, 4:29 PM
  2. How to add mask for Store.sync()
    By devil in forum 2.x Help
    Replies: 2
    Last Post: Apr 01, 2013, 2:15 PM
  3. Store Sync() Method Big Issue
    By shaileshsakaria in forum 2.x Help
    Replies: 10
    Last Post: Jan 14, 2013, 8:00 AM
  4. [CLOSED] REST store sync callback
    By thesvr in forum 2.x Legacy Premium Help
    Replies: 7
    Last Post: Nov 08, 2012, 12:57 PM
  5. [CLOSED] Store Sync Date Problem
    By softmachine2011 in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Sep 27, 2012, 1:40 PM

Posting Permissions