【发布时间】:2014-01-10 10:58:24
【问题描述】:
使用 Primefaces 3.5,当我尝试对动态列使用自定义排序功能时,我得到一个 PropertyNotFoundException。
我在 xhtml 文件中的数据表是(只显示相关代码)
<p:dataTable id="dataTableVersioneMonitoraggio" var="row" value="# {monitoraggioBean.pacchetti}"
rowKey="#{row.pacchetto.id}">
<p:columns value="#{monitoraggioBean.columns}" var="column"
sortBy="#{row.celle[column.posizione].cella.valore}"
sortFunction="#{monitoraggioBean.customSort}">
...
</p:columns>
</p:dataTable>
我认为作用域支持 bean 中不完整的方法是:
public int customSort(Object val1, Object val2) {
System.out.println("mySort" + val1 + "/" + val2);
return 0;
}
问题是我无法在 bean 中访问此方法,并且出现以下错误:
GRAVE [javax.enterprise.resource.webcontainer.jsf.context] (http--0.0.0.0-8080-3) javax.el.PropertyNotFoundException: /monitoraggio.xhtml @80,161 sortFunction="#{monitoraggioBean.customSort}": The class 'com.packman.bean.MonitoraggioBean' does not have the property 'customSort'.
我尝试了使用 p:column 标签的自定义排序功能,它可以工作。
有什么想法吗?
谢谢
【问题讨论】:
-
这个问题和解决方法也发布在PrimeFaces forum。
标签: primefaces datatable