4 Mar 2013 4:30 AM #1
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...
4 Mar 2013 11:23 PM #2
Does not anyone know anything about this here?
5 Mar 2013 11:03 AM #3
- Join Date
- Sep 2010
- Cluj, Romania
- Vote Rating
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.
13 Mar 2013 4:31 AM #4
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)