View Full Version : How does store... proxy: { type: ajax, api: work?

17 Oct 2011, 8:25 AM
How does
var store = Ext.create('Ext.data.Store', {
model: 'Writer.Person',
autoLoad: true,
autoSync: true,
proxy: {
type: 'ajax',
api: {
read: 'app.php/users/view',
create: 'app.php/users/create',
update: 'app.php/users/update',
destroy: 'app.php/users/destroy'
}, ... work? Does the sync function just do a compare between the gui instance of the data and the store in memory, and then based on differences it finds, decide what operation to perform? I'm trying to get a 'destroy' to work, and it tries to use either create or update....

I'm using [CODE]objStorekv.remove(objStorekv.getAt(value));[CODE] in my delete function, and operation.action always = 'update'. What gives?

many thanks in advance!

17 Oct 2011, 9:39 AM
So a Store loads using the read. If you add a record to that store, when you do a sync() it will fire off (and batch) all the new records using the create. If you edit existing records (not new ones), it will use the update. If you remove a record from the store, it will use the destroy.

17 Oct 2011, 9:55 AM
that's my problem
I'm using
objStorekv.remove(objStorekv.getAt(value)); in my delete function, and operation.action always = 'update'.