使用 dataScroller 在同一页面上使用两个数据表时出错
Error on use two dataTables on same page with dataScroller
我有两个rich:datatables,每一个都有钱data: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。
我找到了这个问题的答案
只需要在每个dataTable + dataScroller中创建一个h:panelGrid
即可
不要问这是为什么
我有两个rich:datatables,每一个都有钱data: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。
我找到了这个问题的答案
只需要在每个dataTable + dataScroller中创建一个h:panelGrid
即可
不要问这是为什么