I have a Store with autosync:true
.
When loading the store, I'm getting complete models:
[{"id":11,"active":true,"name":"ABC","sens":7,"details":119,"type":13,"acl":false,"create":true,"delete":true,"owner":"alexander","members":"gustave\njerome"}]
When syncing a new model to the server, I'll send it with "id":0
, so the server knows it has to create a new one. The server will then respond {"success":true,"data":[12],"debug":[]}
, where 12
is the id of the newly created entry.
Now I have to add a callback function for the autoSync operation to patch the ids I receive back into the store.
If I had synced manually, this would have been easy:
Ext.getStore("RightsStore").sync({
success:function() {
}
})
But how can I get a special success or a callback function for insert syncs into a store that works with autoSync?
If the server sent {"success":true, "data"[{"id":12, ....}]}
then you do not need to do anything. Best is if server sends back complete records it received for CRUD operation with the updated data (in same order). Ext takes care of the rest.