Sencha touch 2 正在从Sencha Touch 2中的Localstorage代理中删除记录
所以我的问题是这个。我可以从localstorage代理中删除记录,第一次就可以了。但是如果我再这样做,它会给我一个错误,商店里的所有东西都是未定义的,就像它不再存在一样Sencha touch 2 正在从Sencha Touch 2中的Localstorage代理中删除记录,sencha-touch-2,Sencha Touch 2,所以我的问题是这个。我可以从localstorage代理中删除记录,第一次就可以了。但是如果我再这样做,它会给我一个错误,商店里的所有东西都是未定义的,就像它不再存在一样 onTapRemoveKegelReminder: function(button) { console.log(button.getData()); //Find and delete the button and the record var store = Ext.getStore('Kegel
onTapRemoveKegelReminder: function(button) {
console.log(button.getData());
//Find and delete the button and the record
var store = Ext.getStore('KegelReminders');
store.load();
store.filter('button_id', button.getData());
var record = store.first();
console.log(record);
console.log(button.getData());
console.log('Remove count'+ store.getCount());
if (typeof record !== 'undefined'||record!=null ) {
store.remove(record);
store.sync();
console.log('removed record correctly')
this.trainingCount--;
var rmButton = this.getKegelExercises().down('#container-' + button.getData());
this.getKegelExercises().remove(rmButton);
}
但是,如果我重新启动应用程序,然后再次删除,它就可以正常工作。我似乎无法在不重新启动应用程序的情况下删除多次 FYI如果其他人发现了此情况,从存储中删除记录只会将其从存储的该实例中删除,而不会从存储机制(例如localstorage)中删除。如果要这样做,必须在模型对象上使用
store.remove(record); // may not even be necessary
record.erase();
store.sync();
仅供参考,如果其他人发现此情况,从存储中删除记录只会将其从存储的该实例中删除,而不会从存储机制(例如,localstorage)中删除。如果要这样做,必须在模型对象上使用
store.remove(record); // may not even be necessary
record.erase();
store.sync();
应该提到的是,如果仅使用擦除方法,则存储不会刷新,这意味着列表显示旧数据。应该提到的是,如果仅使用擦除方法,则存储不会刷新,这意味着列表显示旧数据。