【发布时间】:2012-03-19 09:40:55
【问题描述】:
我正在使用带有底层 TreeStore 的 NestedList。现在我想将项目作为叶子添加到 NestedList。 我该怎么做?
目前我的代码(控制器,onAddButtonTapped)如下所示:
var store = Ext.getStore('menuStore');
var customerAreaNode = store.getRoot().getChildAt(1);
customerAreaNode.appendChild({name: "text", leaf:true});
customerAreaNode.expand();
store.sync();
此代码导致叶级别(正确节点后面)两个新的空侦听器和节点级别的一个新列表条目。 每个新条目在 NestedList 中都没有显示名称,但每个条目的名称字段中都包含“文本”。奇怪的是,叶级别的新条目之一并未输入到基础模型中。所以找不到对应模型的方法:
Uncaught TypeError: Cannot call method 'getSelectedName' of undefined
有人知道如何将数据添加到 NestedList/TreeStore 的简单教程吗?我在 sencha touch 文档中找不到一个很好的例子。
【问题讨论】:
-
这可能会有所帮助:stackoverflow.com/questions/9655201/… --- 我在我的手机上,所以我无法测试代码,看看这是否能让你开始
标签: sencha-touch-2 nested-lists tree-structure