我有自定义排序的数据表。它对包含我的数据的数组进行排序,然后通过ajax调用刷新表。该表有多个列,其中包含简单文本,另外一列包含命令按钮和命令链接。我的问题是,这个按钮和链接没有刷新。这意味着如果我单击第二行上的按钮,它会影响排序前第二行中的元素。
这是页面代码:
<h:body>
<h:form class="page_frame">
<a4j:jsFunction name="sortTable" render="data_table@body"
actionListener="#{MyBean.getFilteredData()}" >
<a4j:param name="param1" assignTo="#{MyBean.newSortBenchmark}"/>
</a4j:jsFunction>
<rich:dataTable value="#{MyBean.getFilteredData()}" var="data" id="data_table"
rowClasses="odd-row, even-row" styleClass="even_odd"
style="width: 900px;">
<rich:column >
<f:facet name="header">
<span onclick="sortTable('name')">Name</span><br/>
</f:facet>
<h:outputText value="#{data.name}"/>
</rich:column>
//more similar columns with sorting
<rich:column>
<f:facet name="header">Start/Stop</f:facet>
<a4j:commandButton value="Start" action="#{MyBean.startProcess(data)}"
rendered="#{!data.processRunning}"
render="data_table@body"
execute="@this" style="width: 100%" >
</a4j:commandButton>
<a4j:commandButton value="Stop" action="#{MyBean.stopProcess(data)}"
rendered="#{data.processRunning}"
render="data_table@body"
execute="@this" style="width: 100%" >
</a4j:commandButton>
</rich:column>
<rich:column>
<f:facet name="header">Actions</f:facet>
<a4j:region>
<a4j:commandLink action="#{MyBean.showDetails(data)}" oncomplete="#{rich:component('detailsPanel')}.show()" render="details_table" >
<h:graphicImage id="details_image" name="details.png" library="images" style="border:0" />
<rich:tooltip followMouse="true" target="details_image" value="Details" />
</a4j:commandLink>
</a4j:region>
//more similar command links, also not working
</rich:column>
</rich:dataTable>
</h:form>
</h:body>
过滤完成于:
Collections.sort(dataList, new dataComparator(sortBenchmark));