2 Replies Latest reply on Nov 18, 2008 6:31 AM by nimo22

    set value by event ontabenter (like actionparam)

    nimo22

      I have this:

      <rich:tabPanel switchType="ajax" selectedTab="#{thisTab}">
      
      <rich:tab id="tab1" name="Tab1">
      ..
      </rich:tab>
      
      <rich:tab id="tab2" name="Tab2">
      <s:link view="/otherPage.xhtml" value="Other Page"/>
      </rich:tab>
      
      </rich:tabPanel>


      The default value of #{thisTab} is tab1.

      I want, that when I click the tab2, then my value #{thisTab} should change to tab2.

      This works:

      <rich:tab id="tab2" name="Tab2">
      <s:link view="/otherPage.xhtml" value="Other Page">
      <a4j:actionparam name="setTab" value="tab2" assignTo="#{thisTab}"/>
      </rich:tab>


      But I cannot use a4j:actionparam, as I have not always links or buttons inside my tab.

      So I need something like:

      <rich:tab id="tab2" name="Tab2" ontabenter="???">
      <s:link view="/otherPage.xhtml" value="Other Page"/>
      </rich:tab>


      So you see, when the event ontabenter occurs, then the value #{thisTab} should be set to tab2.

      How can I do that??


        • 1. Re: set value by event ontabenter (like actionparam)
          nbelaevski

          Hello,

          Try this variant:

          <rich:tab id="tab2" name="Tab2">
          Some text
          <a4j:actionparam name="setTab" value="tab2" assignTo="#{thisTab}"/>
          </rich:tab>


          Tab itself is a source of action events so that should work.

          • 2. Re: set value by event ontabenter (like actionparam)
            nimo22

            hey thanks, that works!!

            As I need to catch a special event, I use this version, it also works:

            I use this:

            <rich:tabPanel switchType="ajax" selectedTab="#{thisTab}">
            <rich:tab id="tab2" name="Tab2">
            Some text
            <a4j:support event="onlabelclick">
            <a4j:actionparam name="setTab" value="tab2" assignTo="#{thisTab}"/>
            </a4j:support>
            </rich:tab>
            </rich:tabPanel>


            thanks!