« Return to Thread: RECURSE DYNAMIC TREE

Re: RECURSE DYNAMIC TREE

by malutanpetronel-2 :: Rate this Message:

Reply to Author | View in Thread

You're great man ! Is it really fun ! I still need to adjust a little
bit some other things but the trick(in fact is a code) works ) ! Is
reaaly hard with these async requests and responses and :) but Thank
you !

--- In ydn-javascript@..., "ozgursusoy" <ozgursusoy@...>
wrote:

>
> --- In ydn-javascript@..., "malutanpetronel"
> <malutanpetronel@> wrote:
> >
> > results is containig a list of node id's
> > node is tree.getRoot() on the first call
> >
> > function expandRecursive(node,results){
> > var node;
> > var results = results.toString();
> > alert(node.children.length + " " + results);
> > for (var ki=0, kj=node.children.length; ki<kj; ki++) {
> > var childnode = node.children[ki];
> > var idtoSearch = childnode.data.id;
> > if (parseInt(results.indexOf(idtoSearch)) >=
0){
> > //childnode.expand();
> > expandRecursive(childnode,results);
> > }
> > }
> > }
> >
> > all works if i expand manually all the nodes in my dyanmic tree
based
> > on the YUI example
> >
> > if the nodes are not expanded before, than the procedure fail
> >
> > how can I fix it or how to do it differently please ? what event
and

> > where to insert it ?
> >
> > With kind regards
> > Petronel
> >
>
> in your for loop:
>
> _tree.subscribe("expandComplete", function (node, arg) {
> if (node == childnode){
>        _tree.unsubscribe("expandComplete");
> //code to set new childNode reference
>                 expandRecursive(childnode,results);
> }
> });
>
> fun to watch it work :)
>


 « Return to Thread: RECURSE DYNAMIC TREE

LightInTheBox - Buy quality products at wholesale price!