Richfaces tabPanel - using the same page for different tabs that dynamically change content

I am using Seam 2.1.2 and RichFaces 3.3.2.SR1.

<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}" 
    tableState="#{manBean.tableState}" selection="#{manBean.selection}" 
    rowKeyVar="rkvar">
    <rich:column sortable="false" id="bc_col_0">
        ...

The content extendedDataTableshould depend on the selected tab. My first approach was to set actionListeneron tabs and change manBeaninside this action. After that actionListener, even if I can see in the logs what has changed manBean, this does not affect the page in the browser. It doesn't seem to be refreshing. I tried installing rerenderin rich:tab, but that also does not do this.

Any idea? Also pleases with other approaches, this may not be the best.

+3
source share
2

, , ... , ui: param.

<rich:tabPanel switchType="ajax">
  <rich:tab label="TAB 1" >
      <ui:include src="/pages/agenda/TabContain.xhtml">
         <ui:param name="dataModel" value="#{dataBean.dataset1}" />
      </ui:include>
  </rich:tab>
  <rich:tab label="TAB 2">
     <ui:include src="/pages/agenda/TabContain.xhtml">
       <ui:param name="dataModel" value="#{dataBean.dataset2}" />
     </ui:include>
  </rich:tab>

resusableDataTable

<rich:extendedDataTable value="#{dataModel}" ....>
    <rich:column sortable="false" id="bc_col_0">
....
</rich:extendedDataTable>

"dataModel" TabContain.xhtml , # {dataModel}.

, , .

+3

ok, actionListener ( ).

actionListener

1- 2- bean :

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

3- bean, value extendedDataTable

4- important!: f:subview - ui:include -, " "!

, ?

.

+1

Source: https://habr.com/ru/post/1734240/


All Articles