|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
RECURSE DYNAMIC TREEresults 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 |
|
|
Re: RECURSE DYNAMIC TREECheck property dataLoader:
http://developer.yahoo.com/yui/docs/YAHOO.widget.Node.html#property_dataLoader if it is null, go ahead, if it is set, then check dynamicLoadComplete: http://developer.yahoo.com/yui/docs/YAHOO.widget.Node.html#property_dynamicLoadComplete If false, don't try to read the element because it is not there yet. Satyam 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 > > > ------------------------------------ > > Yahoo! Groups Links > > > > > No virus found in this incoming message. > Checked by AVG - http://www.avg.com > Version: 8.0.135 / Virus Database: 270.4.4/1532 - Release Date: 03/07/2008 8:32 > > > > |
|
|
Re: RECURSE DYNAMIC TREE--- 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 :) |
|
|
|
|
|
Re: RECURSE DYNAMIC TREEYou'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)) >= > > //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 :) > |
|
|
Re: RECURSE DYNAMIC TREEHow should I modify the part bellow if recursivity must stop only if
the fathers are also identical: tree.subscribe( "expandComplete" , function (node, arg) { if ((node == childnode) tree.unsubscribe( "expandComplete" ); } expandRecursive(childnode, results, IdNod); }}; With kind regards Petronel --- 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)) >= > > //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 :) > |
| Free Forum Powered by Nabble | Forum Help |