tags:

views:

22

answers:

2

Hi All,

I am using jsf with Richfaces. I've created a tabpanel using <rich:tabpanel>. I have taken 4 tabs like tab1, tab2, tab3 and tab4. if I run the application tab1 is default one. If I go to next tab I use navigation for every tab like NEXT<< and PREV>> .

  1. If I click on a tab label, it is also changing the tabs. if I run the application, I want tab1 to be active and all others tabs are disabled (like tab2 or tab3 are disabled. If I click navigation buttons, only the tabs will be active.)

  2. If I run the application, the tab1 will be active after fill up the tab1 details click the NEXT<< navigation then tab2 is active. Now the tab1 and tab2 are active. tab3 and tab4 are inactives.

What are the solution for the above two questions?

A: 
 <rich:tabPanel switchType="ajax">
        <rich:tab label="First">
            Here is tab #1
        </rich:tab>
        <rich:tab label="Second" disabled="true">
            Here is tab #2
        </rich:tab>
        <rich:tab label="Third" disabled="true">
            Here is tab #3
        </rich:tab>
    </rich:tabPanel>  

here second and third tab will be disabled , you can do something like

disabled= #{Bean.isDisabledTab1}  

And handel it on next ,previous

org.life.java
A: 

Complementing org.life.java answer, you can add an action listener to the button or link that you are clicking when you switch tabs, for example:

                <a4j:commandLink id="identifierLink" value="#{bean.ID_COUNT}"
                actionListener="#{bean.switchTab}" reRender="clientTabPanel, clientTable">
                    <f:param  id="internalID" value="#{bean.INTERNAL_ID}" name="internalIDParam"/>
            </a4j:commandLink>

The switchTab action listener method would contain the logic to enable or disable the other tabs (just like org.life.java mentioned), and you could use f:param in case you want to pass something to your action listener when deciding to switch or not. I think you need to re-Render the tabPanel when you update the related property for the "disabled" attribute.

Abel Morelos