2 Replies Latest reply on Apr 30, 2008 9:33 AM by matt.hibb

    rich:tab action question

    matt.hibb

      Hi All,

      I have a page with the following tabbed view:

      <rich:tabPanel>
       <rich:tab label="One" action="#{bean1.fetchData}">
       <h:outputText value="#{bean1.showSomeData}"/>
       </rich:tab>
       <rich:tab label="Two" action="#{bean2.fetchData}">
       <h:outputText value="#{bean2.showSomeData}"/>
       </rich:tab>
      </rich:tabPanel>
      


      The problem I'm having is that tab "One" is shown initially, but fetchData is not called on bean1. Therefore when tab "One" initially displays, the data in bean1 hasn't been populated and I'm not showing any data. After the initial page load, clicking the tabs works as I expected.

      Couple of questions:
      1. Am I missing something obvious? Is there a way to force a call to action on the default tab when the page is initially loaded?
      2. Does anyone think I've got the wrong idea trying to load tab data like this, as I only started with JSF a couple of days ago ;)

      Thanks in advance

        • 1. Re: rich:tab action question
          ilya_shaikovsky

          action called only after actionEvent fired. So no switching - no action event. On initial loading actions certainly doesn't fired.

          • 2. Re: rich:tab action question
            matt.hibb

            Thanks for the reply.

            I understand the reasoning behind why the action is not fired. But I'm struggling to find a way to load the data for the panel/tab on initial page load.

            I can probably come up with some hacky way round this, which is making me feel I've got the wrong idea! Am I doing this wrong, can someone point me in the right direction on how I should probably handle this cleanly.

            Thanks