PDA

View Full Version : [2.0b1][CLOSED] childNodes is an empty array



Lucian
13 Oct 2007, 12:14 AM
Hi!..

Consider using the tree example from /examples/tree/reorder.html .


Ext.onReady(function(){
// shorthand
var Tree = Ext.tree;

var tree = new Tree.TreePanel({
el:'tree-div',
autoScroll:true,
animate:true,
enableDD:true,
rootVisible: false,
containerScroll: true,
loader: new Tree.TreeLoader({
dataUrl:'get-nodes.php'
})
});

// set the root node
var root = new Tree.AsyncTreeNode({
text: 'Ext JS',
draggable:false,
id:'source'
});
tree.setRootNode(root);

// render the tree
tree.render();
root.expand();

console.dir(root.childNodes); :-?
});

Why childNodes is an empty array?...Is there another way to iterate the children nodes?

evant
13 Oct 2007, 2:27 AM
Because the tree is loaded asynchronously, once you expand the node, there will be a short period until the call is made to the server.

This is not a bug.