sortBy迟到,只需点击后台

时间:2017-06-14 08:49:12

标签: jsf primefaces columnsorting

当我尝试使用Primefaces中的sortBy属性执行列排序时遇到此问题。使用sort事件我意识到行的顺序在UI中更新,但在后端列表没有改变,只有在我执行另一次排序后它才会改变,但它会随着所选旧列的顺序而改变,所以后端的顺序是后面有一个排序。我可以正确执行表上的其他操作,我可以将值保存在数据库中。唯一的问题是使用ajax排序事件或使用属性sortBy。

  <p:dataTable id="dataTable" var="row"
rowIndexVar="rowIndex"
paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
rowsPerPageTemplate="10,50,100,200,300" paginatorPosition="top"  paginator="true" rows="10"
value="#{table.rows}" rowKey="#{row.id}"
selection="#{data.selectedRow}" selectionMode="single"
styleClass="table">
<p:ajax event="sort"
  listener="#{manager.testUpdate}"
  update="dataTable" />
<p:column
  headerText="id"
  styleClass="align"
  sortBy="#{row.id}">
  <h:outputText value="#{row.id}" />
</p:column>
<p:column
  headerText="name"
  styleClass="align"
  sortBy="#{row.name}">
  <h:outputText value="#{row.name}" />
</p:column>

.....

0 个答案:

没有答案