jsp - Primefaces 的扩展数据表共享相同的分页状态?
问题描述
Primefaces 的扩展数据表共享相同的分页状态?我正在研究primefaces7。我有一个 primefaces 数据表,其行将扩展以加载子表数据,但我发现子故事共享相同的分页状态。
步骤如下:
- 在代码中,将子表每页的行数全部设置为3,然后启动应用程序。
- 点击主表第一行,加载第一个子表的数据,每页加载3行数据。
- 将第一个子表的行数从3改为6,第一个子表将加载每页6行的数据。
- 单击主表上的第二行,第二个子表仍然加载,每页 6 行,但是,正确的行为应该是每页 3 行。
- 将第二个子表的行数从 6 更改为 3。
- 折叠主表的第一行,然后再次展开,现在第一个子表在每页加载 3 行,这与预期的结果不同,它应该在每页加载 6 行数据。
提供以下两个图像以提供更清晰的信息。 https://note.youdao.com/yws/public/resource/944651b2b0a5f1fd15ba638f29761212/xmlnote/BF343E65325749A1A1AC1A4CC2BA4176/3832
这是代码。
<p:dataTable var="hosp"
binding = "#{hospitalController.hospitalTable}"
value="#{hospitalController.hospData}"
paginator="true"
rows="10"
paginatorPosition="bottom"
paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
currentPageReportTemplate="{currentPage} of {totalPages} pages, {totalRecords} records"
rowsPerPageTemplate="5,10,15"
lazy="true"
id="hospitalTable"
widgetVar="hospitalTable"
>
<p:ajax event="rowToggle" listener="#{hospitalController.doToggle(hosp.hospitalId)}"/>
<f:facet name="header">
<h:outputText value="Hospital List" />
</f:facet>
<p:column style="width:16px">
<p:rowToggler></p:rowToggler>
</p:column>
<p:column headerText="Hospital Code">
<h:outputText value="#{hosp.hospitalId}" />
</p:column>
<p:column headerText="Hospital Name">
<h:outputText value="#{hosp.hospitalName}" />
</p:column>
<p:rowExpansion>
<p:panelGrid columnClasses="label, value">
<p:dataTable value="#{hospitalController.subHospData}"
var="subHosp"
id="subHospTable"
paginator="true"
rows="3"
lazy="true"
paginatorPosition="bottom"
paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
currentPageReportTemplate="{currentPage} of {totalPages} pages, {totalRecords} records"
rowsPerPageTemplate="3, 6"
>
<p:column headerText="Hospital Name" filterBy="#{subHosp.hospitalName}">
<h:outputText value="#{subHosp.hospitalName}" />
</p:column>
<p:column headerText="Hospital Area">
<h:outputText value="#{subHosp.areaName}" />
</p:column>
<p:column headerText="Contact Person">
<h:outputText value="#{subHosp.contactPerson}" />
</p:column>
</p:dataTable>
</p:panelGrid>
</p:rowExpansion>
</p:dataTable>
好像所有子表都共享同一个分页状态,如何将它们分开,让每个子表保持自己的分页状态?
解决方案
推荐阅读
- webserver - 我在 Windows10 上安装了“本地”,然后将其卸载....为什么仍然有这么多“虚构大学”的实例在运行?
- node.js - NodeJS selenium-driver geckodriver 普通 Firefox
- flutter - 如何将红色星号符号添加到颤动的文本格式中
- javascript - 变量和对象在部署时出现未定义错误
- android - Android 受信任的 Web 应用程序:将对象(不是字符串)从 Java 传递到 TWA
- java - Logback 不使用 logger.error(message, throwable) 记录异常
- javascript - React-konva 移动缩放和可拖动图像
- python-3.x - 出现在错误位置的 tk.Toplevel 窗口
- javascript - Vuex getter 数据在刷新时消失
- git - 复制我的工作目录以试验代码,然后从中创建一个新的存储库