2 Replies Latest reply on Jul 17, 2008 11:07 AM by jlindesmith

    rich:tree losing state after navigating to new page

    jlindesmith

      Hi all,

      First let me say that I am using JBoss 4.2.2
      Richfaces 3.2.1 GA, JSF, and SEAM 2.0.0

      I am having the following issue with the rich:tree component in IE 6:

      1) User expands at least one node of the tree.
      2) User clicks on a link rendered as one of the nodes in the tree to navigate to another page in the same browser window.
      3) The new page is displayed in the browser.
      4) User clicks on the Back button.
      5) The tree is rendered with all nodes collapsed. The tree is no longer expanded.

      Also, I am using switchType = "ajax".

      The same case works fine in FireFox i.e. the tree is still expanded after the user clicks the Back button.

      I am binding the componentState and tree to session scoped properties in a session scoped bean.

      This is what I have seen suggested on the forums.

      It is not working. The tree is still only rendering the top level and the nodes that were expanded are no longer expanded.

      What am I doing wrong or is this a bug with Richfaces 3.2.1 GA?

      I did see a bug documented in JIRA:

      http://lists.jboss.org/pipermail/richfaces-issues/2008-May/018086.html

      Is it that bug?

      Anyway, here is my rich:tree code:

      <s:div rendered="#{search.viewType.equalsIgnoreCase('orderPackage')}">
       <h:form>
       <rich:tree switchType="ajax" showConnectingLines="false" componentState="#{treeHelper.treeState}"
       binding="#{treeHelper.tree}">
       <rich:recursiveTreeNodesAdaptor nodes="#{search.resultList}" roots="#{search.resultList}"
       var="listItem" includedNode="false">
       <rich:treeNode changeExpandListener="#{search.processExpansion}" iconCollapsed="/img/layout/expand.gif" iconExpanded="/img/layout/collapse.gif"
       data="#{listItem.data}" icon="/img/layout/blank.gif" ignoreDupResponses="false">
       <h:outputLink value="/rba_modernization/xhtml/view/viewCOI.seam">
       <f:param name="orderId" value="#{listItem.data}" />
       <s:conversationPropagation type="join" />
       <h:outputText value="#{listItem.linkText}" />
       </h:outputLink>
       </rich:treeNode>
       <rich:recursiveTreeNodesAdaptor nodes="#{search.orderPackageSecondLevel}" roots="#{search.orderPackageSecondLevel}"
       var="orderPackageSecond" includedNode="false">
       <rich:treeNode changeExpandListener="#{search.processExpansion2}" iconCollapsed="/img/layout/expand.gif" iconExpanded="/img/layout/collapse.gif"
       data="#{orderPackageSecond.data}" icon="/img/layout/blank.gif" ignoreDupResponses="false">
       <h:outputLink value="#{orderPackageSecond.linkValue}">
       <h:outputText value="#{orderPackageSecond.linkText}" />
       </h:outputLink>
       </rich:treeNode>
       <rich:recursiveTreeNodesAdaptor nodes="#{search.orderPackageThirdLevel}" roots="#{search.orderPackageThirdLevel}"
       var="orderPackageThird" includedNode="false">
       <rich:treeNode changeExpandListener="#{search.processExpansion3}" iconCollapsed="/img/layout/expand.gif" iconExpanded="/img/layout/collapse.gif"
       data="#{orderPackageThird.data}" icon="/img/layout/blank.gif" ignoreDupResponses="false">
       <h:outputLink value="#{orderPackageThird.linkValue}">
       <h:outputText value="#{orderPackageThird.linkText}" />
       </h:outputLink>
       </rich:treeNode>
       <rich:recursiveTreeNodesAdaptor nodes="#{search.orderPackageFourthLevel}" roots="#{search.orderPackageFourthLevel}"
       var="orderPackageFourth" includedNode="false">
       <rich:treeNode changeExpandListener="#{search.processExpansion4}" iconCollapsed="/img/layout/expand.gif" iconExpanded="/img/layout/collapse.gif"
       data="#{orderPackageFourth.data}" icon="/img/layout/blank.gif" ignoreDupResponses="false">
       <h:outputLink value="#{orderPackageFourth.linkValue}">
       <h:outputText value="#{orderPackageFourth.linkText}" />
       </h:outputLink>
       </rich:treeNode>
      
       <rich:treeNodesAdaptor nodes="#{search.orderPackageFifthLevel}" var="orderPackageFifth">
       <rich:treeNode iconLeaf="/img/layout/blank.gif">
       <h:outputLink value="#{orderPackageFifth.linkValue}">
       <h:outputText value="#{orderPackageFifth.linkText}" />
       </h:outputLink>
       </rich:treeNode>
       </rich:treeNodesAdaptor>
       </rich:recursiveTreeNodesAdaptor>
       </rich:recursiveTreeNodesAdaptor>
       </rich:recursiveTreeNodesAdaptor>
       </rich:recursiveTreeNodesAdaptor>
       </rich:tree>
       </h:form>
       </s:div>
      



      And here is my bean code:

      
      ...
      
      @Name("treeHelper")
      @Scope(ScopeType.SESSION)
      public class SearchTreeHelper {
      
       @Logger
       private static Log log;
      
       @RequestParameter
       private String firstResult;
      
       @In(required=false, scope=ScopeType.SESSION)
       @Out(required=false, scope=ScopeType.SESSION)
       private SearchQuery search;
      
       @In(required=false, scope=ScopeType.SESSION)
       @Out(required=false, scope=ScopeType.SESSION)
       private TreeState treeState;
      
       @In(required=false, scope=ScopeType.SESSION)
       @Out(required=false, scope=ScopeType.SESSION)
       private UITree tree;
      
       public String getFirstResult() {
       return firstResult;
       }
      
       public void setFirstResult(String firstResult) {
       this.firstResult = firstResult;
       }
      
       public SearchQuery getSearch() {
       return search;
       }
      
       public void setSearch(SearchQuery search) {
       this.search = search;
       }
      
       public TreeState getTreeState() {
       return treeState;
       }
      
       public void setTreeState(TreeState treeState) {
       this.treeState = treeState;
       }
      
       public UITree getTree() {
       return tree;
       }
      
       public void setTree(UITree tree) {
       this.tree = tree;
       }
      
      ...
      
      


      Thanks for everyones help,

      jlindesmith