3 Replies Latest reply on Sep 10, 2010 3:49 AM by Ilya Shaikovsky

    Expand the Tree Programmatically

    Devika N Newbie


      i want to expand the tree node programmatically i have got sollution to expand and collapse the complete tree. But i want to expand the selected node till the leaf node. as of now i have code which expands the node only at one level.  Here the sample that i tried, any help is highly



      this code will expand the tree of the selected node but to only one level.


          public void expandTreeStructure() {
              try {
                  final TreeState state = (TreeState) sampleTreeBinding.getComponentState();
                  final TreeRowKey key =state.getSelectedNode();
                  sampleTreeBinding.walk(FacesContext.getCurrentInstance(), new DataVisitor() {
                      public void process(FacesContext context, Object rowKey, Object argument)
                              throws IOException {
                              state.expandNode(sampleTreeBinding, (TreeRowKey) rowKey);
              } catch (IOException e) {



      But i want to expand the selected node completly till the leaf node. that means something needs to called recursivly which i am not getting.