On the first tab, I have a p:commandButton with update="tabSetComp:staffEnrollTabView".
This is the component Id of the container and the Id of the tabView.
The action for that button calls a function to verify the contents on the tab, and if correct, will go to tab 2.
The tabView has the activeIndex bound to a session bean property (activeTabIndex).
If the updates are correct, I set the activeTabIndex to 1 to move to the second tab.
The problem is that the tabView does not change to tab2 by setting the activeIndex of the tabView.
I have verified that the activeTabIndex is getting udated in the session bean.
Am I missing something, or is there another way I should be setting the active tab index to view the next tab?
Here is a piece of the tabView and the commandButton:
Code: Select all
<cc:implementation>
<p:outputPanel id="tabPnl" >
<h:form id="staffEnrollTabForm" styleClass="staffEnrollTabForm" prependId="false" >
<p:tabView id="staffEnrollTabView" dynamic="true" activeIndex="#{enrollSessionBean.activeTabIndex}" >
<p:tab id="staffEnrollTab1" title="General Info" >
<!--esc:generalInfoTab id="generalInfoTabComp" /-->
<p:outputPanel id="staffEnrollTab1Pnl1" styleClass="staffEnrollTabPnl1" >
<body of tab1...>
<p:commandButton id="updateBtn" styleClass="updateBtn"
action="#{enrollSessionBean.updateBut_action}"
disabled="#{enrollSessionBean.disableStaffGeneral}"
value="Update/Next"
update="tabSetComp:staffEnrollTabView" />
</h:panelGrid>
</p:outputPanel>
</p:outputPanel>
</p:tab>
<p:tab id="staffEnrollTab2" title="User Info" >
<p:outputPanel id="staffEnrollTab2Pnl1" styleClass="staffEnrollTabPnl1" >
<body of tab 2...>
</p:outputPanel>
</p:tab>
<p:tab id="staffEnrollTab3" title="Identity" >
<!--esc:identityTab id="identityTabComp" /-->
<p:outputPanel id="staffEnrollTab3Pnl1" styleClass="staffEnrollTabPnl1" >
<body of tab 3... >
</p:outputPanel>
</p:tab>
</p:tabView>
</h:form>
</p:outputPanel>
</cc:implementation>
Code: Select all
public String updateBut_action()
{
String s = updateGeneralInfo();
if( s.equalsIgnoreCase( "tab2" ))
{
setActiveTabIndex(1);
}
return null;
}