1 Reply Latest reply on Nov 30, 2007 10:06 AM by Jeff Jo

    rich:tab with switchType ajax have reRender problem

    Thiagu Mariappan Novice

      Hello,
      i am using rich:tabPanel with switchType cliend
      i need to invoke a method when i click a particular tab.
      so i invoke that method by using action propertiey, and i change the switchType to that particular tab as ajax. here what i have a problem is
      now i can invoke that mothod , but the tab is not opened.
      i try to reRender the rich:tabPanel all ways but i can't

      this is my sample code

      <rich:tabPanel id="tabpanelid" switchType="client">
      <rich:tab label="Name" id="nameid">
      <ui:include src="name.xhtml"></ui:include>
      </rich:tab>
      <rich:tab label="Employee" id="employeeid" switchType="ajax" action="#{search.newsearch}">
      <ui:include src="employee.xhtml"></ui:include>
      </rich:tab>
      </rich:tabPanel>
      
      if i use switchType as a server to that particular tab it is working.
      but i dont need to load the form when i click the that particular tab.
      
      please any one help me
      By
      Thiagu.m
      


        • 1. Re: rich:tab with switchType ajax have reRender problem
          Jeff Jo Newbie

          Have you tried binding the selectedTab attribute of tabPanel to see what the values are in the back-end? This is what I have and it works:

          <a4j:form id="formid" >
           <rich:tabPanel switchType="ajax" selectedTab = "#{controller.selectedTab}" >
           <rich:tab label="Meetings" actionListener="#{controller.switchToMeetingsTab}" name="meetings" ajaxSingle="true">
           <a4j:region id="tab_meetings_region">
           <a4j:include id="tab_meetings_include" viewId="tab_meetings.jsp" />
           </a4j:region>
           </rich:tab>
           <rich:tab label="Other" actionListener="#{controller.switchToOtherTab}" name="other" ajaxSingle="true">
           <a4j:region id="tab_other_region">
           <a4j:include id="tab_other_include" viewId="tab_other.jsp" />
           </a4j:region>
           </rich:tab>
           </rich:tabPanel>
          </a4j:form>
          


          In my controller, i have the following:

          public void switchToMeetingsTab(ActionEvent event){
           //perform some cleanup logic
           if (cleanupPassed){
           this.previousTab = this.selectedTab;
           }
           else{
           this.selectedTab = this.previousTab
           }
          }
          


          I keep the previousTab variable in the controller in case the user switches tabs when they shouldn't have (in which case, it brings them back to the previous tab). Hope this helps.