2 Replies Latest reply on Oct 22, 2008 8:04 AM by srama1

    tree maintaining state not working.

    srama1

      I have a dynamic tree that is retrieving nodetext from database. I also have the implementation for 2 levels of treenode opened when tree is displayed,
      What I need now is I want to maintain the state of the tree when I click any leafnode. I tried to follow this link My Link
      but, not succesful. I am using attribute componentState from treeComponent, 



      <rich:tree switchType="client" stateAdvisor="#{treeStateAdvisor}" componentState="${treeComponentState}">





      @Scope(ScopeType.SESSION)
      @Name("treeComponentState")
      public class TreeComponentState {
      
           private UITree tree;
      
           private TreeState treeState;
      
           public UITree getTree() {
                return tree;
           }
      
           public void setTree(final UITree tree) {
                this.tree = tree;
           }
      
           public TreeState getTreeState() {
                return treeState;
           }
      
           public void setTreeState(final TreeState treeState) {
                this.treeState = treeState;
           }
      
      }




      I am not sure if I am using componentState in proper way. How is the tree manipulated to keep the state? Any help is appreciated.











        • 1. Re: tree maintaining state not working.
          swd847

          In the richfaces docs it specifies that componentState must evaluate to org.ajax4jsf.model.DataComponentState. Try:



          <rich:tree switchType="client" stateAdvisor="#{treeStateAdvisor}" componentState="${treeComponentState.data}">




          @Scope(ScopeType.SESSION)
          @Name("treeComponentState")
          public class TreeComponentState {
          
               DataComponentState data;
          
                  //getter and setter for data
          
          }


          • 2. Re: tree maintaining state not working.
            srama1

            Doesn't work :( , Any other suggestions?