Results 1 to 3 of 3

Thread: Reseting a model after a grid sync with 4.1

  1. #1
    Sencha User
    Join Date
    Mar 2010
    Posts
    492
    Answers
    12
    Vote Rating
    2
      0  

    Default Reseting a model after a grid sync with 4.1

    1. I have multiple grids, and the user can drag and drop records across these grids.
    2. As the drop happens, I set a property - 'X' - depending on the store that the record was dropped into.
    3. On pressing the 'Save' button, I initiate the 'sync' method.
    4. If certain records don't commit successfully, I catch the exception and report it to the user.
    5. Now, I'd like to reinstate these unsuccessful records back to the grids that the user dragged them from and reset the property 'X' back to its original value.


    What is the best way to accomplish step 5? Thanks!

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,409
    Answers
    716
    Vote Rating
    504
      0  

    Default

    Can you setup an array that holds the exception records and load them back into the store?

    Regards,
    Scott.

  3. #3
    Sencha Premium Member
    Join Date
    Oct 2010
    Posts
    62
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by scottmartin View Post
    Can you setup an array that holds the exception records and load them back into the store?

    Regards,
    Scott.
    Thanks for the reply!

    Here is what I'm essentially doing right now:

    Code:
    store.proxy.on({
        exception: function(proxy, response, operation) {
            Ext.each(operation.records, function(record) {
                if(!Ext.isEmpty(record)) {
                    store.remove(record);
                    record.reject();
                    originalStore.add(record);
                }
            });
        }
    });
    I noticed that without record.reject(), the record remains dirty. It works for the most part, except that getRemovedRecords() on the originalStore still does return me the record even after add it to the store.

    I guess I'm looking for an efficient way to bring the record and the original store back to their original states (as if nothing happened in between).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •