p:tabView question

UI Components for JSF
Post Reply
burferd
Posts: 234
Joined: 01 May 2010, 16:15

11 Jun 2010, 23:35

I have a composite component that contains a tabView with 3 tabs.
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>
Here is the button action method:

Code: Select all

    public String updateBut_action()
    {

        String s = updateGeneralInfo();
        if( s.equalsIgnoreCase( "tab2" ))
        {
            setActiveTabIndex(1);       
        }
        return null;
    }
Using PrimeFaces 3.4, Mojarra 2.1.6, Glassfish 3.1.2, NetBerans 7.2, Hibernate 3.2.5 (sometimes)
Windows 7.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 55 guests