View Full Version : 4.1.1.a store sync does many posts , when it has to do just one with multiple batch

8 Nov 2012, 10:09 AM
Extjs 4.1.1.a

When user edits one store and for example, deletes 2 records, add 1 record, and update 1 record
When i execute store.sync() in firebug i can see 4 POST sends, when i think that this should be just one POST with multiple data and operations sended.

is this a bug in 4.1.1.a ? I cannot try it now, but i think that in 4.1.1 this works with just one post.

8 Nov 2012, 5:09 PM
With what you gave and suppose you set store.autoSync to false, store.sync() will:
- Generate a POST (default) request for creating the added record.
- Generate a POST (default) request for updating the modified record.
- Generate a POST (default) request for detroying two deleted records if you set proxy.batchActions to true which is default setting. In case you set proxy.batchActions to false, two POST requests will be generated.
This is the same for Ext 4.1.1 and 4.1.1a.

9 Nov 2012, 12:07 AM
vietits, if i have understanded, the normal function of sync() when operating in batch mode is to do at least one POST per operation. It means if there are new , updated and deleted records, at least sync() will send 3 POST one for each operation type. Is that also the maximum number of posts ? I mean, if there are for example: 10 new records, 5 updated and 2 deleted....sync() will have to send 3 POSTS ?

9 Nov 2012, 4:46 AM
Yes, if you set batchActions to true which is default setting. In case batchActions set to false, 10 new records will generate 10 POST for creating, 5 updated records will generate 5 POSTs for updating, etc.