1 Reply Latest reply on Feb 25, 2010 8:34 AM by schuck

    tabPanel - using the same page for the different tabs changing the content dinamically

      Hello,

       

      I am trying to use the same page for the different tabs changing the content dinamically after the use clicks on the tab:


      <a4j:form>
          <rich:tabPanel switchType="ajax">
         <rich:tab label="TAB 1" actionListener="#{outControl.tab1}" immediate="true">
      <ui:include src="/pages/agenda/TabContain.xhtml" />
      </rich:tab>
      <rich:tab label="TAB 2" actionListener="#{outControl.tab2}">
      <ui:include src="/pages/agenda/TabContain.xhtml" />
      </rich:tab>

       

      TabContain.xhtml:

       

      <rich:extendedDataTable value="#{manBean.seDataModel}" var="out" id="bc_table"
      sortMode="#{manBean.sortMode}" selectionMode="#{manBean.selectionMode}">

       

      The content of that extendedDataTable should be dependent of the tab selected. My first approach was to set an actionListener in the tabs and change the "manBean" within that action. After that actionListener even if I can se in the logs that the manBean has changed, this is not reflected in the page in the browser. It's like not refreshing. I tried setting a "rerender" in the rich:tab but that's also not doing it...

      Any idea?


      Also happy about other approaches, this might be not the best one...

       

      Thanks!

        • 1. Re: tabPanel - using the same page for the different tabs changing the content dinamically

          ok, the approach above worked out after a couple of tries using actionListener (I was not changing the correct attribute).

           

          actionListener

          1- it fires when the tab is selected

          2-it grabs the managed bean through:

          ManBean mb = (ManBean) context.getExternalContext().getSessionMap().get("manBean");

          3- it modifies the managed bean which is the "value" in the extendedDataTable

          4- important!: add a f:subview around each -ui:include- to avoid a "duplicate component ID" error!

           

          Would you say there is a better approach for this?

           

          Thanks.