3 Replies Latest reply on Jun 10, 2009 8:53 AM by nbelaevski

    rich:tree - masking unneccesary nodes/elements

      Hi community,

      I have a question concerning rich:tree:
      I have the following output:

      - 100
       - 110
       - 111
       - 112
       - ELEMENT
       - 113
       - 114
       - ...
      
       - 120
       - 121
       - 122
       - 123
       - 124
       - ...
       - ...
      - 200
       - 210
       - 211
       - ELEMENT
       - 212
       - 213
       - ELEMENT
       - ...
      
       - 220
       - 221
       - 222
       - 223
       - ...
       - ...
      - 300
       - 310
       - 311
       - 312
       - ...
      
       - 320
       - 321
       - 322
       - ...
       - ...
      - ...
      


      I'm using the following code to display the object model as a tree:

      <rich:tree id="fgCcAssociation" switchType="ajax" >
       <rich:treeNodesAdaptor id="a" var="itema" nodes="#{classcodeWeb.familyAssociatedCCs}">
      
       <rich:treeNode>
       <h:outputText value="#{itema.functionGroupId}"/>
       </rich:treeNode>
      
       <rich:treeNodesAdaptor var="itema2" nodes="#{itema.children}" >
       <rich:treeNode>
       <h:outputText value="#{itema2.functionGroupId}"/>
       </rich:treeNode>
      
       <rich:treeNodesAdaptor var="itema3" nodes="#{itema2.children}" >
       <rich:treeNode >
       <h:outputText value="#{itema3.functionGroupId}" />
       </rich:treeNode>
      
       <rich:treeNodesAdaptor var="itema4" nodes="#{itema3.children}" >
       <rich:treeNode >
       <h:outputText value=" #{itema4.description}" style="color:red"/>
       </rich:treeNode>
       </rich:treeNodesAdaptor>
      
       </rich:treeNodesAdaptor>
       </rich:treeNodesAdaptor>
      
       </rich:treeNodesAdaptor>
      </rich:tree>
      


      In some cases there is a 4th level within the tree, which is an element below e.g. 112.
      I want to ignore such elements which do not have a child at the 4th level without modifiing the datamodel. So the original tree from above should look like this:
      - 100
       - 110
       - 112
       - ELEMENT
      
      - 200
       - 210
       - 211
       - ELEMENT
       - 213
       - ELEMENT


      Is this possible with rich:tree?

      Thanks for your answers,
      Sam