2 Replies Latest reply on Aug 28, 2007 10:29 AM by Kevin Weisser

    Tabbed Panel Question

    Kevin Weisser Newbie

      I'm new to Ajax4Jsf and have a question.

      I currently have the following component defined in my JSP:

      <odc:tabbedPanel variableTabLength="false" id="tabbedPanel1" showTabs="true" showBackNextButton="false" slantActiveRight="4" styleClass="tabbedPanel" height="50" width="200" slantInactiveRight="4">
      <odc:bfPanel id="bfpanel1" name="Plus" showFinishCancelButton="false" onenter="return func_1(this, event);">
      <h:panelGroup id="mainAdd" styleClass="panelGroup">
      <a4j:include viewId="plusone.jsp"/>
      </h:panelGroup>
      </odc:bfPanel>
      <odc:bfPanel id="bfpanel2" name="Minus" showFinishCancelButton="false">
      <h:panelGroup id="mainMin" styleClass="panelGroup">
      <a4j:include viewId="minusone.jsp"/>
      </h:panelGroup>
      <a4j:support event="onenter" immediate="false" actionListener="#{extAjaxReq.doSubtraction}" reRender="mainMin"/>
      </odc:bfPanel>
      </odc:tabbedPanel>

      I don't want to pull all the data back when the page first loads, to save some time in the background. However if a user clicks on the second tab at that point I want to execute the doSubraction function on my back bean and display minusone.jsp.

      Currently, I see minusone.jsp (which just has 2 outputtext components defined in it) but the doSubtraction function is never being invoked when the tab is clicked.

      What is the proper way to fetch data for tabbed panels?

      Regards,

      Kevin

        • 1. Re: Tabbed Panel Question
          Sergey Smirnov Master

          Why don't you use RichFaces rich:tabPanel where updating the tab during the switching is a standard built-in option?

          • 2. Re: Tabbed Panel Question
            Kevin Weisser Newbie

            I appreciate the suggestion, and have replaced my old tab panel code with the following:

            <rich:tabPanel width="40%" switchType="ajax">
            <rich:tab label="Addition">
            <h:panelGroup id="mainAdd" styleClass="panelGroup">
            <a4j:include viewId="plusone.jsp"/>
            </h:panelGroup>
            </rich:tab>
            <rich:tab label="Subtraction">
            <h:panelGroup id="mainMin" styleClass="panelGroup">
            <a4j:include viewId="minusone.jsp"/>
            </h:panelGroup>
            <a4j:support event="ontabenter" immediate="false" actionListener="#{extAjaxReq.doSubtraction}" reRender="mainMin"/>
            </rich:tab>
            </rich:tabPanel>

            However, when I change tabs it is still not ever hitting the method doSubtraction. Am I still not doing something right?

            Additionally, would there be a way to only fire the Ajax event once as opposed to everytime that the tab is selected?

            Regards,

            Kevin