--- 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 :)