5 Replies Latest reply on May 15, 2009 12:51 PM by igc

    Desperate with rich:tree re-rendering itself :(

    igc

      Hi all. I've been searching trough the forums but couldn't find a solution to my problem, although I think it must be a very usual one.

      I have a rich:tree component on a facelets div. I'm using it as a menu, so when I click a node the page refreshes and its contents are replaced by those of the new page. But of course I want to keep the tree just as it was before re-rendering the page.

      I tried setting the backing bean to session scope and adding some code to prevent it from loading again (loadTree() method is NOT executed ever again after the first load) but it doesn't work: every time I click on a node the page refreshes including the tree, which collapses and shows in the initial state. The user is then forced to expand the tree again, find the last selected node, etc.

      How can I save the state of the rich:tree component? Shouldn't the session scope be the solution?

      Here is my tree:

       <rich:tree id="arbol" style="width:300px" nodeSelectListener="#{arbol.processSelection}"
       reRender="selectedNode" ajaxSubmitSelection="true" switchType="ajax"
       selectedClass="tree_txt_orange" value="#{arbol.treeNode}" var="item" ajaxKeys="#{null}">
       <rich:treeNode iconLeaf="/images/folder.gif" icon="/images/folder.gif">
       <h:commandLink action="#{nav.refrescaPagina}" value="#{item.desc}"/>
       <rich:toolTip>
       <span style="white-space:nowrap">
       <h:outputText value="#{item.cod}" />
       </span>
       </rich:toolTip>
       </rich:treeNode>
       </rich:tree>
      


      I'm using Richfaces 3.3.0GA (along with myfaces and tomahawk), JDK 1.6 and facelets.
      I'm running it on IE6, but tests on Firefox3 fail as well.

      Please help, I'm having such a headache with this issue, which I believe should be easy to solve...

      I can post the code of my backing bean (which, I repeat, is session-scoped) if needed, but I don't really think it has something to do with this problem.

      Thanks a lot in advance for your help.