4 Replies Latest reply on Oct 25, 2012 11:48 PM by Siva P

    Rich TabPanel Issue

    srinivas nandula Newbie

      Hi I have a rich tab panel with some tabs in it. Each tab has specific data it needs to load when i select the tab.The tab has nothing special, just a datatable that needs to load some data.Problem is when i select the tab the first time, the tap opens up with the datatable empty but the data does not load. when i click the tab the second time the data loads into the datatable. I am not sure how to fix this. Can some one help?

       

      My Environment is Richfaces 4.2, JSF 2.0 and Spring Webflow.

       

      Here is my code.

       

      <ui:composition template="../../templates/layout.xhtml">

            <ui:define name="title">

              <h:outputText value="#{msg.add_cg_title}" />

          </ui:define>

          <ui:define name="content">

              <f:view>

                  <h:form id="form1">

                      <h:messages />

       

                          <rich:tabPanel switchType="ajax">

                              <rich:tab header="Caregiver" styleClass="rf-tab">

                                  <ui:include src="CaregiverInfo.xhtml" />

                              </rich:tab>

       

                              <rich:tab header="Award" styleClass="rf-tab" action="loadAwardDecisions">

                                  <ui:include src="awardDecision.xhtml" />

                              </rich:tab>

                          </rich:tabPanel>

                      </rich:panel>

                  </h:form>

       

       

       

              </f:view>

          </ui:define>

      </ui:composition>

       

       

      As you can see when i click on the award tab it should call the method loadAwardDecisions. But it never gets called the first time i select the tab. But if i click again, it does load.

       

      Many Thanks for the help

        • 1. Re: Rich TabPanel Issue
          srinivas nandula Newbie

          Can someone help? i am stuck..

          • 2. Re: Rich TabPanel Issue
            srinivas nandula Newbie

            Experts! any help?

            • 3. Re: Rich TabPanel Issue
              Nejc G Newbie

              There are strange things regarding tabPanel. I suggest you do it some other way.

              • 4. Re: Rich TabPanel Issue
                Siva P Master

                Hi Srinivas,

                 

                I have worked in Richfaces3 only completely.Try like the below solution it will work for you even if you are working with Richfaces4 also,May be you can try it properly,

                try like below,

                 

                1) In our case instead of action in the <rich:tab we are using ontabenter function and calling the backend,

                2) <a4j:function will call the backend bean and display the datatable properly in the screen.

                3) Because we are rendering only the specific region here.

                 

                <a4j:jsFunction  name="CaregiverLoad" limitToList="true" immediate="true"

                actionListener="#{sampleBean.CaregiverAction}"/>

                <a4j:jsFunction  name="loadAwardDecisions" limitToList="true" immediate="true"

                actionListener="#{sampleBean.loadAwardDecisionsAction}"/>

                 

                <rich:tabPanel switchType="ajax">

                 

                                        <rich:tab limitToList="true" header="Caregiver" styleClass="rf-tab" ontabenter="CaregiverLoad()">

                                        <a4j:region id="Caregiverregion">

                                            <ui:include src="CaregiverInfo.xhtml" />

                                        </a4j:region>

                                        </rich:tab>

                 

                 

                 

                                        <rich:tab limitToList="true" header="Award" styleClass="rf-tab" ontabenter="loadAwardDecisions()">

                                        <a4j:region id="awardregion">

                                            <ui:include src="awardDecision.xhtml" />

                                        </a4j:region>

                                        </rich:tab>

                </rich:tabPanel>

                 

                 

                Thanks,

                Siva