I am having some trouble with a Sencha Touch data store and a localproxy. Basically, when a record is removed from the store, using the store.remove(record) method, the record itself is removed from memory, but the Id reference to it in the store is not removed, so when the page is refreshed, I receive a lovely “Uncaught TypeError: Cannot read property ‘isModel’ of undefined”
Here is the code for the store:
Ext.define("App.store.Data", {
extend: "Ext.data.Store",
requires: "Ext.data.proxy.LocalStorage",
config: {
model: "App.model.Data",
autoSync: true,
proxy: {
type: 'localstorage',
id: 'app-store'
}
}
});
Here is the code for the delete button on the data editor page
onDeleteHomeworkCommand: function () {
var dataEditor = this.getDataEditor();
var currentData = dataEditor.getRecord();
var dataStore = Ext.getStore("Data");
dataStore.remove(currentData);
dataStore.sync();
this.activateDataList();
},
Edit:
Here is a screenshot of the data store before the remove method is called:

And here is one after:

Note the Id still stays in the store’s list, which gives me the undefined error when the page is refreshed.
The problem is that the local store proxy does not remove the ID from its internal ID list when you remove the record. You can solve this if you explicitly destroy the record in the proxy with destroy().