在sencha文档中找不到关于此问题的任何相关信息:
是否可以Ext.create(...)使用不依赖于应用程序名称的参数进行调用?那么,如果我更改应用程序的名称,我不必重写那行代码?
通常情况下我会使用,Ext.create(AppName.model.MYMODEL)但这对我来说与应用程序的名称太相关了.
仍然需要帮助:)
使用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 …Run Code Online (Sandbox Code Playgroud)