Topic: How to expand ajax n-level tree ?

Hello,

I have a (big) tree where each node is loaded with Ajax, and there is 3-4 levels of depth. The root is level 0, and when I use the following script (found in this forum), it only open all nodes from level 0 (the root), but never nodes from level >= 1.

this.root.recursive(function()
{
   // forest is set to true
    if (this.isRoot()) return; 
    this.toggle();
});

I'm trying to find something to expand all nodes from all levels, i.e. to load each of them with Ajax at the loading of the tree.

An idea ?

Thanks.

Re: How to expand ajax n-level tree ?

try expand nodes loaded via ajax using loadNode event, something like:

tree.addEvent('loadNode', function(node){
    node.getChildren().each(function(child){
        child.toggle();
    });
});

Re: How to expand ajax n-level tree ?

It works fine !

Thanks for you reactivity wink