4 Replies Latest reply on Mar 18, 2010 10:32 AM by evialxg

    ontabenter vs action in rich:tab

    nimo22

      Is want to rerender a region within a tab when tab is entered or clicked:

       

      I have tried it with ontabenter and ontabclick, but action is not fired:

       

      Version 1:

       

      <rich:tabPanel switchType="ajax">

      <rich:tab label="My Tab">

       

      <h:form>
      <a4j:support event="ontabenter" action="#{myBean.doAction}" reRender="myDiv"/>
      </h:form>

       

      <s:div id="myDiv">
                     ..
      </s:div>
      </rich:tab>

       

       

      When using this version, action is fired and all works:;

       

      Version 2:

       

      <h:form>

      <rich:tabPanel switchType="ajax">

      <rich:tab label="My Tab" action="#{myBean.doAction}"  reRender="myDiv">


      <s:div id="myDiv">
                      ..
      </s:div>
      </rich:tab>

      </h:form>

       

      But the problem with Version 2 is, that I need a form around the whole component, and this is not what I want.

       

      How can I make Version 1 to work?

        • 1. Re: ontabenter vs action in rich:tab
          evialxg
          try  the event onlabelclick of the tab.
          1 of 1 people found this helpful
          • 2. Re: ontabenter vs action in rich:tab
            nimo22

            thanks, I changed the label text to a commandLink and wrap that within a form - this works.

            • 3. Re: ontabenter vs action in rich:tab
              nimo22

              Oh the thread is not answered:)

               

              I need to fire the action when tab is changed, so onlabelclick or the following version does not help me, because I have to click the label of the tab and not the tab itself.

               

              Why does "ontabenter" not work?

               

               

              <rich:tab label="mylabel">
              <h:form>
              <a4j:support event="ontabenter" action="#{bean.myAction}" reRender="region"/>
              </h:form>


              <div id="region">

              </div>

              </rich:tab>

              • 4. Re: ontabenter vs action in rich:tab
                evialxg

                I have no idea why the ontabenter does not work...I realized it too a few days ago.. I just did this :

                 

                  <rich:tab label="mylabel" onlabelclick="someAj4Function()">
                
                </rich:tabpanel>
                

                 

                and whenever the user clicks the tab the action inside the jsFunction is executed...

                I haven't seen any difference between clicking the tab and clicking the label..