使用dataScroller在同一页面上使用两个dataTable时出错

时间:2017-04-12 22:00:26

标签: java jsf richfaces

我有两个丰富的:datatables,每个都有一个丰富的数据:scroller。

<rich:dataTable id="mainTable"
                summary="#{i18n['br.com.petrobras.crud.datatable.summary']}"
                styleClass="TableGrid"
                value="#{bean1.objectDataModel}"
                var="historicoItem"
                first="#{bean1.jsfPagination.firstItemIndex}"
                rows="#{bean1.jsfPagination.pageSize}">
</rich:dataTable>

<rich:dataScroller id="**scrollerHistorico**" styleClass="Pagination"
                   for="mainTable" maxPages="1" fastControls="hide"
                   renderIfSinglePage="false"
                   page="#{bean1.jsfPagination.currentPageForView}">

</rich:dataScroller>
<rich:dataTable id="anexoGridId"
                summary="#{i18n['br.com.petrobras.crud.datatable.summary']}"
                styleClass="TableGrid"
                value="#{bean2.objectDataModel}"
                var="anexoVar"
                first="#{bean2.jsfPagination.firstItemIndex}"
                rows="#{bean2.jsfPagination.pageSize}">
</rich:dataTable>

<rich:dataScroller id="**scrollerAnexoTratamentoControle**" styleClass="Pagination"
                   for="anexoGridId" maxPages="1" fastControls="hide"
                   renderIfSinglePage="false"
                   page="#{bean2.jsfPagination.currentPageForView}">
</rich:dataScroller>

但是当我向下一页或最后一页调用任何操作时,页面只刷新并显示日志消息:

(好像我对两个数据表使用了相同的引用,但事实并非如此。

12/04/2017 18:59:48 org.richfaces.event.DataTablePreRenderListener processActiveDatascroller
GRAVE: Datascroller components attached to component: formPrincipal:scrollerHistorico have different values of 'page' attribute : 
[formPrincipal:scrollerAnexoTratamentoControle: #{bean1.jsfPagination.currentPageForView},
formPrincipal:scrollerHistorico: #{tratamentoControleHistoricoBean.jsfPagination.currentPageForView}]
12/04/2017 18:59:48 org.richfaces.event.DataTablePreRenderListener processActiveDatascroller
GRAVE: Datascroller components attached to component: bean2have different values of 'page' attribute : 
[formPrincipal:scrollerAnexoTratamentoControle: #{anexoTratamentoControleBean.jsfPagination.currentPageForView},
formPrincipal:scrollerHistorico: #{tratamentoControleHistoricoBean.jsfPagination.currentPageForView}]

对此的影响是在操作(和日志消息)之后,所有数据都失去了参考ID。

1 个答案:

答案 0 :(得分:0)

我在这个问题上找到了答案https://stackoverflow.com/a/21400850/4529796

只需创建以在每个dataTable + dataScroller

中包含h:panelGrid

不要问为什么这个