商店和数据视图列表 - 无法添加元素 - IndexOf为null

Faw*_*war 1 extjs sencha-touch sencha-touch-2 sencha-architect

使用Sencha Touch(2.2)和Sencha Architect 2

我有一个树形结构,我在其中导航.

节点是元素,元素可以是文件夹或叶子.

要在Ext.dataview.dataview(LIST)上显示元素,我使用商店(storeID:'elementstore')和Ext.dataview.component.Dataitem.

这是我的代码,首先填写LIST,每次我们打开一个文件夹深入树中.

第一次填充商店,禁用事件,因此update()不会被调用两次我将在创建它之后立即切换到此视图.它运作良好,并回馈所需的结果.我在我的列表中显示了第一级文件夹和Leaf.

这是使用onItemTap事件直接在列表中触发的

var EStore = Ext.getStore('elementstore');
EStore.removeAll();
EStore.suspendEvents();
EStore.add(record.get('arrElement'));
EStore.resumeEvents(true); 
Run Code Online (Sandbox Code Playgroud)

使用达到的树级别清空和重新填充商店.

这是通过onItemTap事件直接在LIST中触发的

if(record.get('strUIType') === 'folder')
    {
        INDEX_STACK.push(index);
        store = Ext.getStore('elementstore');
        store.removeAll();
        store.add(record.get('arrElement'));
    }
Run Code Online (Sandbox Code Playgroud)

当我试图向后走,在我的树上上升时,出了什么问题.这是位于Sencha控制器中的代码.

它实际上不会回到一个级别,而是返回顶级.ACTIVE_PROJECT是
活动树的索引,它们都位于我的项目存储中.

var popped =INDEX_STACK.pop();
var tab = tabpanel.getParent().getParent().getParent().getComponent('projects_Tab');

if(popped === undefined)
{
    tab.setActiveItem(0);
}
else
{
    var eStore = Ext.getStore('elementstore');
    eStore.removeAll();

    //Crashes!
    eStore.add(Ext.getStore('projectstore').getAt(ACTIVE_PROJECT).get('arrElement'));
}
Run Code Online (Sandbox Code Playgroud)

你有没有看到eStore.add(....)是崩溃的行,我得到以下错误:

Uncaught TypeError: Cannot call method 'indexOf' of null sencha-touch-all.js:21
Ext.Array.contains.e 
Ext.Array.include 
Ext.define.join 
Ext.define.insert 
Ext.define.add 
Ext.define.onMain_TabsTap  (----Yep this line is my code the rest is sencha touch...
Ext.define.doFire
Run Code Online (Sandbox Code Playgroud)

我在该控制器中添加到商店的唯一方法是空的Ext.create(CarboZero.model.Element).我的活动项目无法得到任何结果.

删除和读取有什么问题吗?我的商店是否因使用它而受损?我一直在努力工作大约2天没有得到任何正常工作......

编辑问题

我只是在我的Element存储区中将destroyRemovedRecords设置为FALSE.

一切正常,但我不明白为什么它用我的特定结构纠正了问题...什么是删除()正在做什么?

Faw*_*war 5

将Element store的属性设置为以下内容

destroyRemovedRecords : false
Run Code Online (Sandbox Code Playgroud)

解决问题,仍无法解释原因.