我有一个定义如下的treelist:
{
xtype: "treelist",
itemId: "MainMenu",
store: {
root: {
expanded: true,
children: [{
text: "One",
leaf: true,
iconCls: "x-fa fa-frown-o"
}]
}
}
}当我加载一个页面时,我看到这个treelist呈现为ok。然后单击一个按钮,它执行以下代码:
mainmenu.getStore().add({
text: "Two",
leaf: true,
iconCls: "x-fa fa-frown-o"
});
console.log(mainmenu.getStore().getCount()); // prints out correct value 2问题是,我仍然只看到treelist中的一个项目。换句话说,treelist存储中填充了新的数据,但没有显示它。那我怎么才能修好呢?我想应该有某种刷新或更新方法,这将刷新树视图。
发布于 2017-04-29 16:10:31
您的问题可能是不正确地使用TreeStore。树存储有一个根,该根的子根由TreeList递归显示。但是,要实际添加到树存储中,应该使用NodeInterface。
就你而言:
mainmenu.getStore().getRootNode().appendChild({
text: "Two",
leaf: true,
iconCls: "x-fa fa-frown-o"
});https://stackoverflow.com/questions/43697741
复制相似问题