Skip to main content
Inspiring
May 15, 2010
Question

jump between cftreeitems

  • May 15, 2010
  • 1 reply
  • 513 views

Hi

I need a way to jump between cftreeitems with a JS function

My treeitem href will be a javascript:jumpTo(id) type function.

But I have no idea how to make the tree expand to the right node.

I am using cf8 with format type HTML cf forms. I am using a CFLoop to build my tree items, not a Bind statement.

Can anyone give me an example of how to accomplish this?

Thanks in advance.


Tim

    This topic has been closed for replies.

    1 reply

    Inspiring
    May 16, 2010

    I am not a heavy cftree user. But it uses the YUI library.  So your function could probably grab the desired "node" from the cftree and call node.expand(). Then grab the parent node (ie node.parent property) and expand it. Continue walking up the tree, expanding each parent, until you hit the root node.

    var tree = ColdFusion.Tree.getTreeObject('yourTree');

    var node = tree.getNodeBy...(...); // by property or index

    while (node != null && !node.isRoot()) {

         node.expand();

         node = node.parent;

    }

    http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=JavaScriptFcns_26.html

    http://developer.yahoo.com/yui/docs/YAHOO.widget.TreeView.html

    http://developer.yahoo.com/yui/docs/YAHOO.widget.Node.html

    nicetimAuthor
    Inspiring
    May 17, 2010

    Thank you for the post!!

    I have taken your conecpt and applied it to my application.

    It is working thanks again

    Tim