PDA

View Full Version : deleting from localstorage



xnakxx
20 Dec 2010, 8:18 AM
Ext.regModel('favs', {
fields: [{name: 'id', type: 'int'},{name: 'date', type: 'string'},{name: 'mlid', type: 'string'},{name: 'address', type: 'string'}],
proxy: {
type: 'localstorage',
id : 'PMZFavs'
}
});


PMZ.favs = new Ext.data.Store({
model: 'favs',
sorters: 'date',
autoLoad: {
callback: function(records) {
console.log(records);
}
}
});
I can add records easy enough and display them in a list, but when i try to delete


//snippet from onItemTap...
selectedRecord = dataview.store.getAt(index);
dataview.store.remove(selectedRecord);
the list gets updated sans the deleted item, but the record is never actually deleted from the local store.

VinylFox
20 Dec 2010, 12:07 PM
You need to call the sync method on your store to update the version in localstorage to match what JS has in memory.