Jsf 请求不';t在primefaces数据表中呈现响应
我有一个带有搜索字段和排序命令链接的数据表。我用来触发排序的commandLink不在列标题中,而是在datatable的标题中。当我加载页面并仅使用commandLink对所有内容进行排序时,一切正常。表格按两个顺序排序,我在页面上看到结果。在globalFilter中搜索时出现问题。它也能工作,但在那之后我就不能整理我的桌子了。我清除了globalFilter的inputText,无法对表进行排序。总之,我只在不使用搜索字段时才看到排序结果。排序操作正常,但请求不更新数据表。我把代码放在下面。也许有人知道怎么解决它Jsf 请求不';t在primefaces数据表中呈现响应,jsf,primefaces,Jsf,Primefaces,我有一个带有搜索字段和排序命令链接的数据表。我用来触发排序的commandLink不在列标题中,而是在datatable的标题中。当我加载页面并仅使用commandLink对所有内容进行排序时,一切正常。表格按两个顺序排序,我在页面上看到结果。在globalFilter中搜索时出现问题。它也能工作,但在那之后我就不能整理我的桌子了。我清除了globalFilter的inputText,无法对表进行排序。总之,我只在不使用搜索字段时才看到排序结果。排序操作正常,但请求不更新数据表。我把代码放在下面
<ui:composition>
<p:panel header="Moje pomiary" footer="#{msgs.footer}" id="myMeasurement">
<h:form id="form" prependId="false">
<p:dataTable var="m" value="#{myMeasurementTable.measurement}" id="measureList" editable="true"
widgetVar="mTable"
emptyMessage="No files found with given criteria" filteredValue="#{myMeasurementTable.filteredMeasurement}" >
<f:facet name="header">
Sortowanie według: <p:commandLink id="sortByName" actionListener="#{myMeasurementTable.sortByName}" update="measureList">
<h:outputText value="nazwa pliku" />
</p:commandLink>
|<h:commandLink action="#{myMeasurementTable.sortByArchivisationDate}"> data archiwizacji </h:commandLink>
|<h:commandLink action="#{myMeasurementTable.sortByMeasureDate}"> data badania </h:commandLink>
<p:outputPanel styleClass="searchPanel">
<h:outputText value="Szukaj: " />
<p:inputText styleClass="globalFilter" id="globalFilter" onkeyup="mTable.filter()" style="width:150px" />
</p:outputPanel>
</f:facet>
<p:column headerText="Informacje pomiarowe" style="width:125px" filterStyle="display:none" filterBy="#{m.fileName} #{m.measureDate} #{m.place} #{m.archivisationDate}"
filterMatchMode="contains" >
<p:separator styleClass="separatorColumn"/>
Nazwa pliku: <h:outputText value="#{m.fileName}" /><br />
Data badania: <h:outputText value="#{m.measureDate}" /><br />
Data archiwzacji: <h:outputText value="#{m.archivisationDate}" /><br />
Miejscowość: <h:outputText value="#{m.place}"/> <br />
Współrzędne GPS:
</p:column>
<p:column headerText="Wykresy">
<img src="/tmp/21/myfile.xls/myfile.xls_Parametr x.png" width="150"/>
</p:column> </p:dataTable></h:form></p:panel></ui:composition>
索托瓦尼·韦杜格:
|数据归档
|巴达尼亚数据
纳兹瓦·普利库:
巴达尼亚数据:
数据归档文件:
米耶斯科维奇:
Wspórzędne全球定位系统:
还有我的一部分豆子
@ManagedBean(name = "myMeasurementTable")
@ViewScoped
public class myMeasurementTable implements Serializable{
private static final long serialVersionUID = -9193902657201234669L;
private List<Measurement> measurement;
private List<Measurement> filteredMeasurement;
private boolean sortAscending = true;
public myMeasurementTable() {
measurement = new ArrayList<Measurement>();
fillTable(measurement);
}
public String sortByName() {
System.out.println("naciskam sortowanie");
if (sortAscending) {
Collections.sort(measurement, new Comparator<Measurement>() {
@Override
public int compare(Measurement m1, Measurement m2) {
return m1.getFileName().compareTo(m2.getFileName());
}
});
sortAscending = false;
} else {
Collections.sort(measurement, new Comparator<Measurement>() {
@Override
public int compare(Measurement m1, Measurement m2) {
System.out.println(m2.getFileName());
return m2.getFileName().compareTo(m1.getFileName());
}
});
sortAscending = true;
}
return null;
}
@ManagedBean(name=“myMeasurementTable”)
@视域
公共类myMeasurementTable实现了可序列化{
私有静态最终长serialVersionUID=-9193902657201234669L;
私有列表测量;
私有列表过滤器测量;
私有布尔排序设置=true;
公共myMeasurementTable(){
度量=新的ArrayList();
填充表(测量);
}
公共字符串sortByName(){
System.out.println(“naciskam sortowanie”);
如果(排序){
Collections.sort(度量,新比较器(){
@凌驾
公共整数比较(测量m1、测量m2){
返回m1.getFileName().compareTo(m2.getFileName());
}
});
sortAscending=false;
}否则{
Collections.sort(度量,新比较器(){
@凌驾
公共整数比较(测量m1、测量m2){
System.out.println(m2.getFileName());
返回m2.getFileName().compareTo(m1.getFileName());
}
});
sortAscending=true;
}
返回null;
}
好的,我在primefaces论坛上找到了解决方案。很简单。我只在commandButton中添加了oncomplete=“mTable.filter()”,一切正常。好的,我在primefaces论坛上找到了解决方案。很简单。我只添加了oncomplete=“mTable.filter()”单击commandButton,一切按我的要求运行。您运行的是什么版本的primefaces?您运行的是什么版本的primefaces?