1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    13
    Vote Rating
    0
    noncom is on a distinguished road

      0  

    Default Unanswered: Updating ArrayStore after Grid update and sending the changes via Ajax

    Unanswered: Updating ArrayStore after Grid update and sending the changes via Ajax


    I have a Grid that is linked to an ArrayStore, both are in the page script. The ArrayStore is filled with data during page generation. The Grid is enabled to edit fields, one at a time. After the edit, the Grid persists the changes and the whole ArrayStore is sent to server via AJAX (I have configured a proxy in it). All works. However, there are two problems that I am facing with it:

    1) Although the Grid displays the newly entered value, the ArrayStore data does not change. As a consequence, what is sent to server with AJAX is the same data as the page was generated with, without any changes. How do I commit the changes from the Grid to the ArrayStore???

    2) Upon synching, the whole table is sent. I want to avoid it by only sending the rows that have changed. How can I do that?

    I have found some scarce examples of these topics but I cannot figure out a clear view of the matter...

  2. #2
    Sencha User
    Join Date
    Dec 2012
    Posts
    13
    Vote Rating
    0
    noncom is on a distinguished road

      0  

    Default


    Does not anyone know anything about this here?

  3. #3
    Sencha Premium Member vadimv's Avatar
    Join Date
    Sep 2010
    Location
    Cluj, Romania
    Posts
    654
    Vote Rating
    26
    Answers
    21
    vadimv will become famous soon enough vadimv will become famous soon enough

      0  

    Default


    The ArrayStore has by default a memory proxy, not sure how you configured to sync with the server....and is not clear from your words how data is filled in store at page generation. If you would post some code...

    So from your words I suppose you have sth like in the sencha example: http://docs.sencha.com/ext-js/4-1/#!...w-editing.html . Then to get only updated records use store.getUpdatedRecords(). After that you need to commit so to not get them again second time, use store.commitChanges() for this. The same does the store.sync() method except that covers all operations: new, update, remove.


    Hints: read in the docs about phantom and dirty records, see Ext.data.Model.




  4. #4
    Sencha User
    Join Date
    Dec 2012
    Posts
    13
    Vote Rating
    0
    noncom is on a distinguished road

      0  

    Default


    Well, finally I have dismissed using ArrayStore and simply created a Store with a proxy which handles the incoming and outcoming data with AJAX. I think that this is a better approach than I was using originally, where data was infused into the script during page generation. And the real problem was the bad design. Thanks for directions for additional info! I have followed that course and it improved my understanding rather quickly)

Thread Participants: 1

Tags for this Thread