Reputation: 1915
I load FULL tree structure at first time.
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());
});
and try this..
treePanel.root.childNodes // []
But after I expand root node and try again
treePanel.root.childNodes // [obj, obj, obj]
Can I get childNodes without expand root node ?
Upvotes: 3
Views: 2741
Reputation: 8376
It appears that childNodes
is only populated with actual elements. Before you expand that node they are not needed.
What you are looking for is treePanel.root.attributes.children
. That has three elements in it.
Upvotes: 1