3 Replies Latest reply on Apr 7, 2011 7:11 AM by ilya_shaikovsky

    Creating a rich:tree with adaptor on single root node

    tomba

      Hi all,

       

      we're converting from JSF1.2 to JSF2+RF4, but we've hit a bit of a bump with trees.

      With RF4, we've tested a few scenarios, and here is what works:

       

       

                          <rich:tree toggleType="client" var="item">
                              <rich:treeModelRecursiveAdaptor roots="#{quoteOptions.packs}" nodes="#{item.subOptionNodes}" >
                                  <rich:treeNode>#{item}</rich:treeNode>
                                  <rich:treeModelAdaptor nodes="#{item.subOptionNodes}">
                                      <rich:treeNode>#{item}</rich:treeNode>
                                  </rich:treeModelAdaptor>
                              </rich:treeModelRecursiveAdaptor>
                          </rich:tree>
      

       

      This gives me one single tree.

      However, I want seperate trees for the root nodes, so I thought to do this (similar to what we did in JSF1.2:

       

      <h:dataTable cellpadding="0" cellspacing="0" width="98%"  value="#{quoteOptions.packs}" var="pack" styleClass="sortable">
      <h:column>
                          <rich:tree toggleType="client" var="item" >
                              <rich:treeModelRecursiveAdaptor roots="#{pack}" nodes="#{item.subOptionNodes}" >
                                  <rich:treeNode>#{item}</rich:treeNode>
                                  <rich:treeModelAdaptor nodes="#{item.subOptionNodes}">
                                      <rich:treeNode>#{item}</rich:treeNode>
                                  </rich:treeModelAdaptor>
                              </rich:treeModelRecursiveAdaptor>
                          </rich:tree>
      </h:column>
      </h:dataTable>
      

       

      Unfortunately this doesn't render anything.

      I read in the docs that the "roots" attribute on treeModelRecursiveAdapter needs a list of root nodes, but obviously I have just one.

      Is this the reason why the tree isn't built?

       

      How can we work around this problem?

       

      Thanks

      Steven