1. #1
    Sencha User
    Join Date
    Mar 2010
    Posts
    484
    Answers
    12
    Vote Rating
    1
    abcdef is on a distinguished road

      0  

    Default Answered: Auto-synced store and dirty record

    Answered: Auto-synced store and dirty record


    I have a store that auto syncs. I change a record using record.set(), and I confirm that the record has the new value both on client and server, but it is still marked dirty.

    I need to to record.commit() to get rid of the dirty flag, but shouldn't auto-syncing of store reset the dirty field? Am I doing something wrong?

    Thoughts?

    Thanks!

  2. I was addressing your question on whether autosync reset dirty fields and suggesting that you check source code.
    But yes when you use model.set() you should call model.commit() to commit all changes.

  3. #2
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    3,967
    Answers
    334
    Vote Rating
    133
    fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all

      0  

    Default


    Have you checked the source?
    The store's updaterecord event fires when the models commit method has been called.

    http://docs.sencha.com/touch/2.3.1/s...re-method-sync
    http://docs.sencha.com/touch/2.3.1/s...t-updaterecord
    Get more personalized support via a support subscription.

    Want to learn Sencha Touch 2? Check out
    Sencha training
    Sencha Touch in Action

    Need more help with your app? Hire Sencha Services services@sencha.com

    When posting code, please use BBCode's CODE tags.

    Need to include a test case use:
    The official Sencha Fiddle

  4. #3
    Sencha User
    Join Date
    Mar 2010
    Posts
    484
    Answers
    12
    Vote Rating
    1
    abcdef is on a distinguished road

      0  

    Default


    Quote Originally Posted by fmoseley View Post
    Have you checked the source?
    The store's updaterecord event fires when the models commit method has been called.

    http://docs.sencha.com/touch/2.3.1/s...re-method-sync
    http://docs.sencha.com/touch/2.3.1/s...t-updaterecord
    Hmm, I'm sorry, but I don't understand what you mean. My question is whether for a store that has autoSync: true, I'll need to do record.set() and then record.commit() in order to get it to be not dirty. I noticed that record.set() does the change and commit to the server, and so calling record.commit() seems a bit redundant unless I'm missing something. Thanks!

  5. #4
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    3,967
    Answers
    334
    Vote Rating
    133
    fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all

      0  

    Default


    I was addressing your question on whether autosync reset dirty fields and suggesting that you check source code.
    But yes when you use model.set() you should call model.commit() to commit all changes.
    Get more personalized support via a support subscription.

    Want to learn Sencha Touch 2? Check out
    Sencha training
    Sencha Touch in Action

    Need more help with your app? Hire Sencha Services services@sencha.com

    When posting code, please use BBCode's CODE tags.

    Need to include a test case use:
    The official Sencha Fiddle

  6. #5
    Sencha User
    Join Date
    Mar 2010
    Posts
    484
    Answers
    12
    Vote Rating
    1
    abcdef is on a distinguished road

      0  

    Default


    Quote Originally Posted by fmoseley View Post
    I was addressing your question on whether autosync reset dirty fields and suggesting that you check source code.
    But yes when you use model.set() you should call model.commit() to commit all changes.
    Oh okay, got it. Thanks!

Thread Participants: 1