Results 1 to 4 of 4

Thread: Store.rejectChanges() + phantom records

  1. #1
    Ext JS Premium Member Jonny5's Avatar
    Join Date
    Jan 2010
    Location
    Vancouver, BC
    Posts
    30

    Question Store.rejectChanges() + phantom records

    I notice that Store.rejectChanges() only reverts deleted and modified records but not newly added records. How can one also reject newly added records? The goal here is to revert all pending changes in-case an error occurs during the commit operation.

    I have tried the following code snippet, but it is broken. It will remove any record that was previously a phantom record since the last page refresh regardless of whether it was successfully committed to the server or not. Maybe this is another bug? such as a failure to set record.phantom = false after a successful commit?

    Code:
    store.rejectChanges();
    store.each(function(r){
      if(r.phantom){
        store.remove(r);
      }
    });
    So has anyone come across a solution?
    Last edited by Jonny5; 18 Jun 2010 at 1:50 PM. Reason: Wrapping "code" block around code for easier reading

  2. #2

    Default

    store.load()?

  3. #3
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    You not only need to remove phantom records, you also need to restore deleted records.

    But I agree with darthwes: If you already have an error than the best solution is to refresh the data completely.

  4. #4
    Ext JS Premium Member Jonny5's Avatar
    Join Date
    Jan 2010
    Location
    Vancouver, BC
    Posts
    30

    Default

    Currently store.load() is what I am using to work-around this issue. I am looking for a solution that avoids making another HTTP request.

Similar Threads

  1. How to handle new records in store like updated records?
    By maho2nd in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 16 Dec 2009, 2:54 AM
  2. loadData or add a record in a Store and rejectChanges
    By Thomas Triplet in forum Ext 3.x: Help & Discussion
    Replies: 9
    Last Post: 7 Jul 2009, 1:00 PM
  3. Replies: 1
    Last Post: 29 Jun 2007, 12:40 AM

Posting Permissions

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