1 Reply Latest reply on Feb 18, 2008 9:19 AM by Ilya Shaikovsky

    Always select first tab in tabpanel

    Jiri Pejchal Newbie

      I have a modal panel with a tabpanel. When opening the modal panel I need the first tab in the tab panel to be always selected.

      Tab panel has attribute selectedTab, but if set to "first" it's not taken into account during rerendering.

      Why the following code doesn't work?

      Change to second tab after loading, click submit - now I expect the first tab to be selected again.


       <a4j:form ajaxSubmit="true">
       <a4j:commandButton value="Submit" action="#{bean.dummy}"
       reRender="navigationTabs" />
      
       <rich:tabPanel id="navigationTabs" switchType="ajax" height="350"
       selectedTab="first" >
       <rich:tab name="first" label="Tab 1">
       <h:outputText value="You are in Tab 1" />
       </rich:tab>
       <rich:tab name="second" label="Tab 2">
       <h:outputText value="You are in Tab 2" />
       </rich:tab>
      
       </rich:tabPanel>
       </a4j:form>
      

      If I change selectedTab="first" to selectedTab="#{bean.currentTab}" that returns "first" it works.