问题描述
|
我第一次加载FULL树形结构。
var tree = new Ext.tree.TreePanel({
title : \'Simple Tree\',width : 300,height : 300,root : new Ext.tree.AsyncTreeNode({
children : [
{ text : \'one\',leaf : true },{ text : \'two\',{ text : \'three\',leaf : true }
]
})
});
Ext.onReady(function(){
tree.render(Ext.getBody());
});
然后试试这个
treePanel.root.childNodes // []
但是在我扩展根节点并重试之后
treePanel.root.childNodes // [obj,obj,obj]
是否可以在不扩展根节点的情况下获得childNodes?
解决方法
看来“ 3”仅填充有实际元素。在扩展该节点之前,不需要它们。
您正在寻找的是
treePanel.root.attributes.children
。其中包含三个要素。