I have this store:
STORE
Ext.define('App.mystore', {
extend: 'Ext.data.Store',
model: 'App.mymodel',
autoLoad: false,
proxy: {
type: 'ajax',
api: {
read: 'read.php',
create: 'create.php',
update: 'update.php'
},
reader: {
type: 'json',
root: 'data',
totalProperty: 'total',
successProperty: 'success'
},
writer: {
root: 'records',
encode: true,
writeAllFields: false
}
}
});
This store is of a Grid where clicking a button I can add a row,and if I select some previous(inserted yet in database) row I can edit its data.
When all is finished I click a button to sync the store with the database.
This button call a function with this code:
onSave:function(){
var Store=Ext.ComponentQuery.query('mygrid')[0].getStore();
Store.getProxy().setExtraParam('param1',this.Param1);
Store.getProxy().setExtraParam('param2',this.Param2);
Store.getProxy().setExtraParam('param3',this.Param3);
Store.sync({
scope:this,
success : function(response){
Ext.Msg.show({
title: 'Information',
msg: 'All OK',
icon: Ext.MessageBox.INFO,
buttons: Ext.Msg.OK
});
},
failure:function(response){
Ext.Msg.show({
title: 'warning',
msg: 'Error',
icon: Ext.MessageBox.WARNING,
buttons: Ext.Msg.OK
});
}
});
},
Can I sync the store in two steps,first new records,then modified records?Because I need to know if both actions where successfully. Because the users can have added new rows and edited some old ones.