sencha touch:无法从会话存储中删除记录

时间:2015-07-29 09:46:47

标签: javascript html5 sencha-touch sencha-touch-2 session-storage

无法从商店删除记录。

我的模特

Ext.define('touch.model.FilesModel', {
extend: 'Ext.data.Model',
requires: [
    'Ext.data.identifier.Uuid'
],
config: {
    identifier: 'uuid',
    idProperty: 'iD',
    fields: [
        { name: 'iD', type: 'auto' },
        { name: 'fileName', type: 'auto' }
    ]
}
});

这是我的SessionStorage

Ext.define('touch.store.FilesStore', {
extend: 'Ext.data.Store',
requires: [
    'Ext.data.proxy.SessionStorage'
],
config: {
    storeId: 'FilesStore',
    autoLoad: true,
    model: 'touch.model.FilesModel',
    proxy: {
        type: 'sessionstorage',
        id: 'FilesStore-store-unique'
    },
    sorters: [{
        property: 'created',
        direction: 'DESC'
    }]
}
});

我正在尝试从商店中删除记录,但它不起作用。 我试过了:

var filesStore = Ext.getStore('FilesStore');
    filesStore.remove(filesStore.getAt(index)); // fails on this line: "Uncaught TypeError: Cannot read property 'destroy' of null"  remove from the store
    filesStore.sync();
然后我试着去做

var filesStore = Ext.getStore('FilesStore');
    filesStore.getAt(index).erase() // fails with: [ERROR][Anonymous] You are trying to erase a model instance that doesn't have a Proxy specified

0 个答案:

没有答案