3 Replies Latest reply on May 15, 2008 11:45 AM by rajesh ninganola

    unable to code a link on a tree node.

    Janet Barbeau Newbie

      I have been using the TreeNodeImpl to construct a tree - I get the tree -however I am not finding a way to add a link onto the nodes. Other jsf tree implementations are quite simple to do this - you start with the tree, add nodes & add a link to the nodes you want to have links. Trees in richfaces do not seem to be this straight forward. Is there someother impl I should be using. Thanks!

        • 1. Re: unable to code a link on a tree node.
          Ilya Shaikovsky Master

          treeNode childs defines markup for the node. So you might have all you need inside the node. It's tested in our samples. Provide please more info about the way you trying to implement your tree.

          • 2. Re: unable to code a link on a tree node.
            Janet Barbeau Newbie

            test.xhtml:

            <rich:tree value="#{testTreeBean.rootNode}" switchType="client" id="tree">
            </rich:tree>

            TestTreeBean.java

            buildTree(){
            rootNode = new TreeNodeImpl();

            rootNode.setData("ROOT HERE");
            //rootNode.setParent(rootNode);

            TreeNodeImpl accting = new TreeNodeImpl();
            accting.setData("ACCOUNTING");

            TreeNodeImpl queries = new TreeNodeImpl();
            queries.setData("SAS");

            TreeNodeImpl scn51150 = new TreeNodeImpl();
            scn51150.setData("SCN51150");

            queries.addChild("scn51150", scn51150);
            //queries.setParent(queries);

            TreeNodeImpl menu3 = new TreeNodeImpl();
            menu3.setData("MENU 3");


            TreeNodeImpl paper = new TreeNodeImpl();
            //paper.setData("PAPER");
            //HtmlOutputLink link = new HtmlOutputLink();
            //HtmlCommandLink link = new HtmlCommandLink();
            //link.setTarget("detail");
            //link.setRel("stub.xhtml");
            //link.setId("paper");
            //link.setValue("FRED WAS HERE");

            paper.setData("Home");

            menu3.addChild("5", paper);

            TreeNodeImpl menu2 = new TreeNodeImpl();
            menu2.setData("MENU2");
            menu2.addChild("4", menu3);

            //level1.addChild("2", level2);

            rootNode.addChild("1", accting);
            rootNode.addChild("2", queries);
            rootNode.addChild("3", menu2);

            }

            This was my last attempt - basically I want each node to bring up a different page when selected. Thanks for your help!

            • 3. Re: unable to code a link on a tree node.
              rajesh ninganola Newbie

              Hello any body have an idea... abt the link...