PrimeFaces 5.1 filterFunction - 是否可以从 table 中获取整行?
PrimeFaces 5.1 filterFunction - is it possible to get the whole line from the table?
我正在过滤我的数据表并想用自定义函数过滤它。问题是,我想将两列数据表作为输入。实现 filterFunction 的默认签名是 public boolean filter(Object value, Object filter, Locale locale)
并且在 value
参数中它包含 "filterBy"
属性传递的任何内容。是什么让它变得更加棘手 - 我过滤的字段不是关键 - 它可以具有相同的值。是否可以将多个值传递给 "filterBy"
或以某种方式在支持 bean 的过滤器函数中获取整个 dataTable 行?
我找到了解决它的方法:传递给 "filterBy"
属性的任何东西都在 EL(表达式语言)中,所以我可以这样写我的过滤器:
在 xhtml 中:
... filterBy="#{item.property1};#{item.property2}" ...
在过滤函数中:
public boolean filter(Object value, Object filter, Locale locale){
...
String[] properties = value.toString().split(";");
...
我正在过滤我的数据表并想用自定义函数过滤它。问题是,我想将两列数据表作为输入。实现 filterFunction 的默认签名是 public boolean filter(Object value, Object filter, Locale locale)
并且在 value
参数中它包含 "filterBy"
属性传递的任何内容。是什么让它变得更加棘手 - 我过滤的字段不是关键 - 它可以具有相同的值。是否可以将多个值传递给 "filterBy"
或以某种方式在支持 bean 的过滤器函数中获取整个 dataTable 行?
我找到了解决它的方法:传递给 "filterBy"
属性的任何东西都在 EL(表达式语言)中,所以我可以这样写我的过滤器:
在 xhtml 中:
... filterBy="#{item.property1};#{item.property2}" ...
在过滤函数中:
public boolean filter(Object value, Object filter, Locale locale){
...
String[] properties = value.toString().split(";");
...