【发布时间】:2014-10-01 16:22:10
【问题描述】:
我想从另一个刷新我的惰性表。我有以下 xhtml:
<h:form id="tableform">
<p:remoteCommand name="updateTable" update="table" />
<p:dataTable widgetVar="tableWidget" id="table"
selection="#{personBean.selectedPerson}" selectionMode="single"
lazy="true" paginator="true" var="person" rowKey="#{person.id}"
value="#{personBean.personModel}" paginatorPosition="bottom" rows="5"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">
<p:column filterBy="#{person.name}" headerText="Names:"
sortBy="#{person.name}">
<h:outputText value="#{person.name}" />
</p:column>
</p:dataTable>
<p:commandButton value="buttonInForm2" update=":tableform" />
<p:commandButton value="buttonInForm" update="@form" />
</h:form>
<h:form>
<p:commandButton value="directUpdate" update=":tableform" />
<p:commandButton value="directUpdate" update=":tableform:table" />
<p:commandButton value="remoteCommand" oncomplete="updateTable()" />
</h:form>
remoteCommand(我当前的解决方案)和 from 中的按钮刷新表格。但是当我使用“directUpdate”按钮时,表格的过滤文本消失了。但我不明白为什么? (过滤值停留在背景但文字为空)
我知道我可以在 table 上使用 widgetVar.filter() 但分页器将被重置。我的解决方案是 remoteCommand,它一切正常,表格重新加载当前页面和过滤器。 (欢迎提供更好的解决方案)
这个问题为什么reset直接更新文本而不更新表单呢?
感谢您的时间。
【问题讨论】:
标签: jsf primefaces datatable updatemodel