Hi guys, I'm here again with a problem, I don't know what could be wrong.
I have a record saved, then I want to remove that record and add a new one but only "remove" it works, adding the new record doesn't, this is the code:
Code:
var inter1 = Ext.ModelMgr.create({id: 1, Funcion: 'AG', PedidoId: currentDoc, Codigo: Codigo},'interlocutoresModel');
var currentInter = interStore.getAt(0);
if(!currentInter){
interStore.add(inter1);
interStore.sync();
console.log("Add");
}
else{
if (interStore.findRecord('id', currentInter.data.id)) {
interStore.remove(currentInter);
interStore.sync();
console.log("Remove");
}
interStore.add(inter1);
console.log("Update");
interStore.sync();
}
Hope you can help me.
Thanks a lot.