1 Reply Latest reply on Nov 16, 2009 6:22 AM by nbelaevski

    <rich:tree> and stateAdvisor problem

    frisch

      hi everybody,

      I have the following code

      <rich:tree value="#{treeElem.trees}" var="item" stateAdvisor="#{treeDemoStateAdvisor}" switchType="ajax" >
       <rich:treeNode changeExpandListener="#{handler.processExpansion}">
       <h:outputText value="#{item.id} #{item.name}" />
       </rich:treeNode>
      </rich:tree>


      The problem is that when I use the stateAdvisor my tree nodes are expanded but they cannot be collapsed again. It works only when I switch to client but I cannot use the changeExpandListener in that state.

      Here is my TreeDemoStateAdvisor

      @Name("treeDemoStateAdvisor")
      public class TreeDemoStateAdvisor implements TreeStateAdvisor {
      
       public Boolean adviseNodeOpened(UITree tree) {
      
       if (!PostbackPhaseListener.isPostback()) {
       Object key = tree.getRowKey();
       TreeRowKey treeRowKey = (TreeRowKey) key;
       if (treeRowKey == null || treeRowKey.depth() <= 20) {
       return Boolean.TRUE;
       }
       }
      
       return null;
       }
      
       public Boolean adviseNodeSelected(UITree tree) {
       return null;
       }
      
      }



      does anybody have any ideas about this?

      I'm currently working with the 3.3.2.SR1 version from richfaces

      thanks