I am trying to save the changes from the grid to the store but I am not really sure if I’m doing it the right way.
STORE:
store_jvhdr = new Ext.data.JsonStore({
model: 'model_jvhdr',
proxy: {
type: 'ajax',
api: {
read: './journalservlet?batNbr='+batNbr+'&operation=GET_RECORD',
update: './journalservlet',
create: './journalservlet'
},
reader: {
type: 'json',
root: 'data'
}
},
autoLoad: true,
listeners: {
load: function(store, records, successful){
...
}
}
});
This are the listeners attached to the grid
listeners: {
itemdblclick: function(dv, record, item, index, e){
...
},
edit: function(editor, e){
console.log('test');
store_jvdtl.commitChanges();
store_jvdtl.sync();
}
}
Am I missing something?
Using
store_jvdtl.sync();is correct but I don’t think you want to callcommitChanges()the reason for this is thatcommitChanges()marks the records in the store as ‘clean’ or rather, removes their dirty state.As a result, when you call
sync()the store doesn’t think it has any changes to send, so I’d have thought you wouldn’t get the ajax requests made to your proxy api urls.