Wanted: Pre-selected tree node in Flash forms CFTREE

I’m going mad with this. Do you know this situation – you wanna do something very simple and it turns out to be the most ugly and head-banging issue for a while…

For me it’s how to preselect a tree node in a Flash forms CFTREE. It doesn’t seem to be possible with the “offical” tag attributes, but who cares. The Flash forms offer so many ways to tweak their behaviour, but I really got bloodily stucked this time for nearly two days now – args! And it’s not just me, there’s someone else working on it and we just can’t make it working properly.

While playing with that, I learned a lot about the CFTREE and how it compiles down to MXML, but this particular issue nags on me.

Any idea is welcome – help!!! ;)

Post to Twitter Post to Delicious Post to Facebook Post to StumbleUpon

Related posts

  • Sorry, could not find any...
This entry was written by kai, posted on Wednesday September 07 2005 at 12:09 am, filed under Agent K on CF . Bookmark the permalink . Post a comment below or leave a trackback: Trackback URL.

5 Responses to “Wanted: Pre-selected tree node in Flash forms CFTREE”

  1. Hi,

    I’m working with a CFTREE control on a flas form at the moment. I have encountered some problems populating the tree with child items(sub menus).

    May be I can throw light if you haven’t got any solution to your problem. But what do you mean by pre-selected node tree?

  2. Hi Carlos,

    I’m working with a CFTREE control on a flas form at the moment. I have encountered some problems populating the tree with child items(sub menus).

    May be I can throw light if you haven’t got any solution to your problem. But what do you mean by pre-selected node tree?

  3. I, too, spent a long time with this. My final solution was to add an additional text field, and use a binding to display the preselected item there.

    Additionally, I open the branches tree, so that the branch’s (and only that branch and its ancestors) preselected item is already visible.

  4. Ok

    This should work, I had the same problem…
    Selects by attribute id on myTree

    With only the length constant to work on this function successfully selects a node by attribute and displays it in the tree list. With all other branches collapsed…

    function selectNodeWithID(id) {
    //Open All Nodes
    for (i=0;i myTree.setIsOpen(myTree.getTreeNodeAt(i), true);
    }
    //Parent branch flag
    pBranch = true;
    //Parent branch Index
    pIndex = 0;
    treeLength = myTree.length;
    for (i=0;i myNode = myTree.getNodeDisplayedAt(i);
    //Assign Parent Branch
    if ((myTree.getIsBranch(myNode)) && (pBranch)) {
    pIndex = i;
    }
    //Search Node for attribute id -- Change to whatever attribute you want to search
    if ((!myTree.getIsBranch(myNode)) && (id == myNode.attributes.id)) {
    myTree.selectedNode = myTree.getNodeDisplayedAt(i);
    theNode = i;
    pBranch = false;
    }
    }

    //Close All Lower Nodes
    for (i=treeLength;i>theNode;i–) {
    myTree.setIsOpen(myTree.getNodeDisplayedAt(i), false);
    }

    //Get difference from last node
    lastN = myTree.length – theNode;

    //Close all Nodes above Parent Node
    for (i=(pIndex-1);i>=0;i–) {
    myTree.setIsOpen(myTree.getNodeDisplayedAt(i), false);
    }

    //Set index from last Node
    lastN = myTree.length – lastN – 1;

    //Display Selected Node
    myTree.firstVisibleNode = myTree.getNodeDisplayedAt(lastN);
    }

    Regards
    Johan

Leave a Reply