1 Reply Latest reply on Jan 12, 2010 10:09 AM by Peter Len

    Root node of richfaces tree not being displayed.... why?

    Peter Len Apprentice

      Hello,

       

      I have a richfaces tree defined like:

       

      <rich:tree id=

      "rtree" showConnectingLines="true" switchType="client" value="#{planning.resultsTree}" var="results" nodeFace="#{results.type}">

        <rich:treeNode type=

      "root">

             <h:outputText value=

      "#{results.label}" />

        </rich:treeNode>

        <rich:treeNode type="fpi_folder" icon=

      "/img/#{results.icon}">

             <h:outputText value="#{results.label}" />

        </rich:treeNode>

        <rich:treeNode type="icdl">

             <rich:outputText value=

      "#{results.label}" />

        </rich:treeNode>

       

      </rich:tree>

       

      In my Bean, I am using instances of a RichTreeNode (implements TreeNode) which I created.  In the bean function that creates the data for the tree I have ....

       

      public

       

       

      RichTreeNode getResultsTree() {

         RichTreeNode resultRoot =

      new RichTreeNode();

         resultRoot.setLabel(

      "The Root");

         resultRoot.setType(

      "root");

       

         RichTreeNode child =

      new RichTreeNode();

         child.setName(

      "folder 1");

         child.setType(

      "fpi_folder");

         child.setLabel(

      "Folder 1");

         child.setIcon(

      "aaa.png");

         resultRoot.addChild(

      "folder1", child);

       

         RichTreeNode child2 =

      new RichTreeNode();

         child2.setLabel(

      "Child 1");

         child2.setType(

      "icdl");

         child.addChild(

      "icdl1", child2);

       

         return

       

       

      resultRoot;

      }

       

      The problem is that the root node (The Root) is not part of the rendered tree.  I just have the "Folder 1" folder and its child "Child 1".  So the tree looks like Folder 1 --> Child 1 instead of The Root --> Folder 1 --> Child 1.  There are no errors, just a missing root node listed in the tree.

       

      Does anyone have any clues?  Maybe a missing property/attribute?

       

      Thanks for any thoughts on this - Peter