3 Replies Latest reply on Feb 2, 2011 2:32 PM by Ilya Sorokoumov

    How to display a tree with particular nodes expanded by default

    roy33 k Newbie

      Hi All,

       

      Based on dropdown menu option a tree should expand particular nodes of a tree.

       

      I am using Seam with richfaces

      I have implemented expandall and collapseall it is working

      "package view"  tree should be expanded till package node.

      "Class view"      tree shoudl be expanded till class node.

       

      Can you any one provide me some code example so that I can implement it.

       

       

      <rich:tree adviseNodeOpened="#{treeModelBean.adviseNodeOpened}" switchType="client">

          <rich:treeNodesAdaptor id="project" nodes="#{loaderBean.projects}" var="project">

              <rich:treeNode>

                  <h:commandLink action="#{project.click}" value="Project: #{project.name}" />

              </rich:treeNode>

       

              <rich:treeNodesAdaptor id="srcDir" var="srcDir" nodes="#{project.srcDirs}">

                  <rich:treeNode>

                      <h:commandLink action="#{srcDir.click}" value="Source directory: #{srcDir.name}" />

                  </rich:treeNode>

       

                  <rich:treeNodesAdaptor id="pkg" var="pkg" nodes="#{srcDir.packages}">

                      <rich:treeNode>

                          <h:commandLink action="#{pkg.click}" value="Package: #{pkg.name}" />

                      </rich:treeNode>

       

                      <rich:treeNodesAdaptor id="class" var="class" nodes="#{pkg.classes}">

                          <rich:treeNode>

                              <h:commandLink action="#{class.click}" value="Class: #{class.name}" />

                          </rich:treeNode>

                      </rich:treeNodesAdaptor>

                  </rich:treeNodesAdaptor>

       

      Any suggestions will be appreciated..