1. #1
    Sencha Premium Member fbrus001's Avatar
    Join Date
    Oct 2011
    Posts
    11
    Vote Rating
    3
    fbrus001 is on a distinguished road

      0  

    Default Updating store data after confirmation by server

    Updating store data after confirmation by server


    Hello everyone,

    in my Ext JS application, I have a store that synchronizes its data with a remote server via the proxy's "api" configuration. This all works fine. Now, when a record gets updated in the web app and subsequently is sent to the server, the server might change some of the data and send this revised update back to the browser. The same situation is present when a new record gets created, and the server completes the record's data with a database-generated id, the current timestamp or something else. This works fine, too.

    However, this behaviour causes the view to be updated two times - once when the record is updated in the browser and another time when it is updated again with the data sent back by the server. In some cases, this is visible to the user. It also makes it extremely difficult to do something like letting a freshly created record slide into the view, because its HTML element gets updated again shortly after the beginning of the animation. And there may be cases where the server may decide that the requested operation is not allowed or possible at all, for example when deleting records.

    My question is: Is there a proper way to wait with the final store update until the server has sent a response? The store would need some kind of "buffer" with unconfirmed changes, which are not visible in whatever views the store is connected to until the remote side has had its final word on the requested operation.

    Has anyone dealt with a similar problem before?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    898
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Your issue doesn't sound like it is with the store but the grid seeing the new record and then gets updated with the new data.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

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

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

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

  3. #3
    Sencha Premium Member fbrus001's Avatar
    Join Date
    Oct 2011
    Posts
    11
    Vote Rating
    3
    fbrus001 is on a distinguished road

      0  

    Default


    Thanks for your reply! Okay, that's another possibility. In my special case, it's not a grid but a DataView I wrote.

    By default, this gets updated automatically once the data in the store gets updated, so how can I prevent it from doing that?

Thread Participants: 1