0 Replies Latest reply on Mar 25, 2008 2:28 PM by srinivasan muthu

    Tab panel remembering the selected tab

    srinivasan muthu Newbie

      I use JBoss Seam, RichFaces 3.1.4.GA

      I have a simple page where i have 2 links (Report1, Report2) and a Tab Panel (dynamic tabs).

      When user clicks on Report1, the Tab Panel will show certain number of tabs based on the number of reports from the backing bean (ScopeType.PAGE).

      When user clicks on Report2, the Tab Panel will show a different sets of reports meaning different number of tabs.

      The problem is
      1) when user clicks on Report1 link
      2) 3 tabs appear
      3) lets say user selects the 3rd tab
      4) user clicks on Report2 link
      5) 5 tabs appear BUT NOW WITH the 3rd tab selected.

      I believe the this is because the viewstate still remembers the 3rd tab selection for the Tab Panel.

      How do I force a refresh of tab panel when ever the link is clicked (instead of the ajax)?

      Here is my code:
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jstl/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich">

      <h:messages styleClass="message"/>

      <h:form id="reportForm">

      <rich:panel>

      <a4j:commandLink id="id1" value="Report1" ajaxSingle="true" reRender="reportPanel">
      <a4j:actionparam name="reportId"
      assignTo="#{reportCardTree.selectedReportCardNodeId}"
      value="4" />
      </a4j:commandLink>



      <a4j:commandLink id="id2" value="Report2" ajaxSingle="true" reRender="reportPanel">
      <a4j:actionparam name="reportId"
      assignTo="#{reportCardTree.selectedReportCardNodeId}"
      value="5" />
      </a4j:commandLink>



      <a4j:outputPanel id="reportPanel">

      <rich:tabPanel switchType="ajax" selectedTab=">

      <c:forEach items="#{reportCardTree.selectedReportCardNode.reports}" var="report" varStatus="stat">
      <rich:tab label="#{report.title}">

      <rich:panel style="width:100%">

      </rich:panel>
      </rich:tab>
      </c:forEach>

      </rich:tabPanel>
      </a4j:outputPanel>

      </rich:panel>

      </h:form>
      </ui:composition>