1 Reply Latest reply on Mar 13, 2008 1:37 AM by jobb

    Wrong SelectedTab information ?

    jobb

      Hi
      I try to get correct selectedTab in a page with tabPanel. TabPanel has binding to bean and bean reports different selectedTab every time I change tab in tabPanel ??? The first time I click a tab, selectedTab is correct, but clicking on the same tab next time (after clicking others tab) shows another tab id ?



      Page:
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

      <rich:tabPanel switchType="ajax" id="productDetail" binding="#{productCatalogMBean.productDetailTab}">
      <rich:tab label="Id" id="tab1">
      </rich:tab>
      <rich:tab label="Beskrivelse" id="tab2">
      </rich:tab>
      <rich:tab label="Levering" id="tab3">
      </rich:tab>
      <rich:tab label="Relasjoner" id="tab4">
      </rich:tab>
      <rich:tab label="Bestillingsskjema" id="tab5">
      </rich:tab>
      <rich:tab label="Saksbehandler" id="tab6">
      </rich:tab>
      <rich:tab label="Prisdata" id="tab7">
      </rich:tab>
      <rich:tab label="Godkjenn" id="tab8">
      </rich:tab>
      </rich:tabPanel>

      Bean:
      private HtmlTabPanel productDetailTab;

      public HtmlTabPanel getProductDetailTab() {
      return productDetailTab;
      }

      public void setProductDetailTab(HtmlTabPanel productDetailTab) {
      this.productDetailTab = productDetailTab;
      if(productDetailTab!=null) {
      String selectedTab = (String) productDetailTab.getSelectedTab();
      if(selectedTab!=null) {
      log.debug("setProductDetailTab:tabSide="+selectedTab);
      }
      }
      }


      Why it happens ? Have I forgot something here ?

      Another question is how to change tab to desired tab ?
      I used productDetailTab.setSelectedTab("tab5"); but nothing happens ?

      Regards
      Mirek