Hello,
I'm trying to update and delete operations of a record but I localStorage proxy returns the following error (see comments in the code):
Uncaught TypeError: Cannot call method 'update' of undefined
Uncaught TypeError: Cannot call method 'destroy' of undefined
The following code:
Code:
save: function() {
var me = this,
form = me.getForm().down('formpanel'),
values = form.getValues(),
store = me.getList().getStore(),
record;
if(values.id){
record = form.getRecord();
console.log(values) // return object Cliente
console.log(record) // retunr model Cliente populated
//Uncaught TypeError: Cannot call method 'update' of undefined
record.set(values);
}
else{
record = Ext.ModelManager.create(form.getValues(), 'ExtTouch.model.Cliente');
}
record.save();
store.load();
me.getList().deselectAll();
me.getList().up('panel').setActiveItem(me.getList());
},
destroy: function() {
var me = this,
form = me.getForm().down('formpanel'),
record = form.getRecord(),
store = me.getList().getStore();
console.log(record) // return model Cliente populated
console.log(store) // return store Cliente
//Uncaught TypeError: Cannot call method 'destroy' of undefined
store.remove(record);
me.getList().deselectAll();
me.getList().up('panel').setActiveItem(me.getList());
}
Thank's