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>
tabPanel saves its state. To avoid it you should use EL binding that will return values you need.
B.t.w. Do not use ajaxSubmit true on the form without nessesity. In this case you should remove it.