1 Reply Latest reply on Apr 5, 2007 4:04 AM by rzymek

    switching tabs of rich:tabPanel programmatically

    rzymek

      Hi

      I want to switch to a different tab in rich:tabPanel by pressing a button.
      I tried this:

      <rich:tabPanel id="tabTest" switchType="server" binding="#{tabtest.tabPanel}">
       <rich:tab id="tab1" name="tab1" label="tab1" >
       <h:commandButton action="#{tabtest.switchTab}" />
       </rich:tab>
       <rich:tab id="tab2" name="tab2" label="tab2" >
       OK
       </rich:tab>
      </rich:tabPanel>
      

      With the backing bean:
      @Name("tabtest")
      @Scope(ScopeType.SESSION)
      public class Tabs implements Serializable {
       private HtmlTabPanel tabPanel;
      
       public HtmlTabPanel getTabPanel() {
       return tabPanel;
       }
      
       public void setTabPanel(HtmlTabPanel tabPanel) {
       this.tabPanel = tabPanel;
       }
      
       public void switchTab() {
       System.out.println("Tabs.switchTab()");
       tabPanel.setSelectedTab("tab2");
       }
      }
      


      This code gives me no results.
      I'm using richfaces-3.0.0, ajax4jsf-1.1.0, myfaces-1.1.4

      So, how can a switch to the other tab?