0 Replies Latest reply: May 8, 2012 5:52 PM by Jason Ingram RSS

    Nesting rich:treeModelAdaptor

    Jason Ingram Newbie

      I'm using RichFaces 4.2 and I have the Practical RichFaces book.  I like the idea of using the Tree Model Adaptor, further separating business logic from view logic, but I'm having a bit of a problem with it. 

       

      I'd really like to do something similar to this:

       

          <rich:tree>

              <rich:treeModelAdaptor nodes="#{deptBean.departments}" var="department">

                <rich:treeNode>#{department.name}</rich:treeNode>

                <rich:treeModelAdaptor nodes="#{department.employees}" var="employee">

                  <rich:treeNode>#{employee.lastName}, #{employee.firstName}</rich:treeNode>

                </rich:treeModelAdaptor>

              </rich:treeModelAdaptor>

          </rich:tree>

       

      Although I know that it's not the correct syntax, that the var attribute belongs with the rich:tree tag.

       

      In my example, the #{deptBean.departments} returns a list of Department entities, which in turn holds a list of Employee entities that have properties.

       

      How can I access the nested component as an arbitrary object and in turn access its properties using rich:treeModelAdaptor (or something similar)?

       

      Thanks,

      Jason