PDA

View Full Version : Store save results



simon
14 Jul 2010, 11:51 PM
When I save the data from store to database, i call save method:




var writerOrders = new Ext.data.JsonWriter({
encode: true,
writeAllFields: true

});

var store = new Ext.data.GroupingStore({
reader: readerOrders,
writer: writerOrders,
url: 'orderSave.asp',
autoSave: false,
batch:true,
baseParams: {
orderId: ordId,
lw: ordLw,
upID: upID.toString(),
status: 0
}
});
...
...
store.save()

How can I read the result from the save calll? Is there any callback function or something similar like at connection object:

conn.request({...},success: function(resp,opt)....

I tried with save event, but it doesn't work:


store.on('save', function(resp, opt) {
....
});


Any example?

Thanks, Simon

hjones
16 Jul 2010, 6:26 AM
I'm setting a proxy in the store like this...



proxy : new Ext.data.HttpProxy({
api: {
read : ...
update : ...
},
listeners: {
write: function(proxy, action, data, response, rs, options) {
Ext.Msg.alert('Write', 'The Save has completed');
}
}


...and I hook in to the write event.

There must be a better way to do it.