Extjs Ext JS树,在我展开根节点之前childNodes为空(加载完整树结构)
我第一次加载完整的树结构Extjs Ext JS树,在我展开根节点之前childNodes为空(加载完整树结构),extjs,tree,Extjs,Tree,我第一次加载完整的树结构 var tree = new Ext.tree.TreePanel({ title : 'Simple Tree', width : 300, height : 300, root : new Ext.tree.AsyncTreeNode({ children : [ { text : 'one', leaf : true }, { text : '
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', leaf : true },
{ text : 'three', leaf : true }
]
})
});
Ext.onReady(function(){
tree.render(Ext.getBody());
});
试试这个
treePanel.root.childNodes // []
但在我展开根节点并重试之后
treePanel.root.childNodes // [obj, obj, obj]
我可以在不展开根节点的情况下获取childNodes吗?似乎
childNodes
只填充了实际元素。在展开该节点之前,不需要它们
您要查找的是
treePanel.root.attributes.children
。这其中有三个元素。@amol,我更新了一个示例代码。如果我确实需要childNodes(出于复选框原因,当我选中父节点时,所有childNodes都已选中,但不需要展开),那么我该怎么办?