Loading ...
Sorry, an error occurred while loading the content.
 

YUI Treeview Order

Expand Messages
  • douloscristou
    My application is using the treeview for navigation and I am dynamically adding items to the list as they are created using the following:
    Message 1 of 2 , Jun 30, 2009
      My application is using the treeview for navigation and I am dynamically adding items to the list as they are created using the following:

      appData.tree.branches['insuredInfo'+x] = new YAHOO.widget.TextNode({label: "Insured: "+appData.insuredInfo.data[x]['txtName'], href: "javascript:appData.advSect('insuredInfo',"+x+");", expanded: true}, appData.tree.branches['claimInfo'+appData.claimInfo.claimID]);
      appData.tree.render();
      appData.tree.root.refresh();

      This will add a new item to the bottom of the branch specified. Is there a way to insert a new item into the middle of a branches children instead of at the bottom?

      For instance, I have three different types of people attached to a claim: Insureds, Claimants, and Witnesses. I want to keep these types grouped together but not have them separated out (they need to all belong to the same parent, the claim).

      I hope this question is not unclear, but I am basically wanting to know it is possible to control the order of new tree items when adding them dynamically. If not, I can delete the entire tree and recreate each time, but I would prefer to avoid this for obvious reasons.
    • Satyam
      ... First of all, don t use javascript: type of hrefs, they are not recommended. Listen to clickEvent instead, it is safer, supported and it provides you
      Message 2 of 2 , Jun 30, 2009
        douloscristou escribió:
        > My application is using the treeview for navigation and I am dynamically adding items to the list as they are created using the following:
        >
        > appData.tree.branches['insuredInfo'+x] = new YAHOO.widget.TextNode({label: "Insured: "+appData.insuredInfo.data[x]['txtName'], href: "javascript:appData.advSect('insuredInfo',"+x+");", expanded: true}, appData.tree.branches['claimInfo'+appData.claimInfo.claimID]);
        > appData.tree.render();
        > appData.tree.root.refresh();
        >
        First of all, don't use "javascript:" type of hrefs, they are not
        recommended. Listen to clickEvent instead, it is safer, supported and
        it provides you are reference to the Node object.
        > This will add a new item to the bottom of the branch specified. Is there a way to insert a new item into the middle of a branches children instead of at the bottom?
        >
        Sure, insertBefore and insertAfter:

        http://developer.yahoo.com/yui/docs/YAHOO.widget.Node.html#method_insertAfter
        > For instance, I have three different types of people attached to a claim: Insureds, Claimants, and Witnesses. I want to keep these types grouped together but not have them separated out (they need to all belong to the same parent, the claim).
        >
        > I hope this question is not unclear, but I am basically wanting to know it is possible to control the order of new tree items when adding them dynamically. If not, I can delete the entire tree and recreate each time, but I would prefer to avoid this for obvious reasons.
        >
        >
        >
        > ------------------------------------
        >
        > Yahoo! Groups Links
        >
        >
        >
        > ------------------------------------------------------------------------
        >
        >
        > No virus found in this incoming message.
        > Checked by AVG - www.avg.com
        > Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 06/30/09 11:37:00
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.