Primefaces 5.3中dataTable的filterValue始终为null [英] filterValue for a dataTable in Primefaces 5.3 always null

查看:62
本文介绍了Primefaces 5.3中dataTable的filterValue始终为null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对使用primefaces还是比较陌生,并且有一点疑问(已经在primefaces论坛上进行了询问,但到目前为止还没有答复)

I'm fairly new to using primefaces, and have a little doubt (already asked it on the primefaces forum but no reply so far)

是否可以在xls dataExporter上获取过滤器值,更具体地在类似后处理器的方法上获取过滤器值?

我可以通过在dataTable上声明filteredValue来获取过滤后的值.但是filterValue变量不能按预期工作.

Is it possible to get the filter value on a xls dataExporter, more concretely on a postprocessor like method?

I can get the filtered value by declaring the filteredValue on the dataTable. But the filterValue variable isn't working as expected.

我都在dataTable上声明了这样的内容:

I have both declared on my dataTable like this:

filteredValue="#{parqueController.parqueListFiltered}" filterValue="#{parqueController.parqueListFilter}"

filteredValue="#{parqueController.parqueListFiltered}" filterValue="#{parqueController.parqueListFilter}"

当我过滤值时,Bean类上的setter仅针对过滤后的值触发,从而使过滤器值始终为空.

When I filter the values, the setter on the Bean class fires only for the filtered value, making the filter value always null.

我结束了在PrimeFaces上与此相关的线程的发现:

I ended finding this thread on PrimeFaces concerning this:

https://code.google.com/archive/p/primefaces /issues/5361

该问题已在3.5版上报告,从外观上看,该问题已在更高版本中更正/更改..我正在使用5.3版

The issue was reported on version 3.5 and, as it looks, it was corrected/altered for later versions.. I'm using version 5.3

认为这可能是错误吗?回归?还是我只是在这里遗漏了一点并做错了什么?

Think this might be a bug? a regression? or am i just missing a point here and doing something wrong?

最诚挚的问候,谢谢!

米格尔·帕尔梅罗

推荐答案

发现这很尴尬.下载Primefaces源文件.进行调试..得出的结论是,在该列上声明了filtervalue(如果我不是很分散注意力的话)会更快地注意到它..^^)

After finding this awkwardly weird.. downloading Primefaces sources.. debuging.. got to the conclusion that the filtervalue is declared on the column (if i wasnt kinda distracted would've noticed it faster.. ^^)

  <p:column style="width: 20%" filterBy="#{parque.id}" sortBy="#{parque.id}" filterValue="#{parqueController.parqueListFilter}" filterMatchMode="contains">

之后,该值将作为每列的单个字符串返回,如果没有值则为空,并且值.. value ^^为空.在此阶段,请根据需要进行处理..我结束了创建所有过滤器值的列表..在excel后处理器上,总是从列表中获取最后4个值,并迭代这4个值,知道我的列是固定的.

after that the value gets returned as an individual string for each column, empty for no value and value for.. value ^^. On this stage treat it as needed.. I ended creating a List with all of the filter values.. on the excel postprocessor, always take the last 4 values from the list and iterate on those 4 values, knowing my columns are fixed..

我的意思是,在parqueListFilter中获得过滤后的值后,我想这样做的情况下,filteredValue =#{classController.variable}指向您要在我的情况下将值移动到的位置:

What I meant was that the filteredValue=#{classController.variable} points to where you want the values to go in my case after i got the filtered values in parqueListFilter i did like this:

List<String> tail = parqueListFilters.subList(Math.max(parqueListFilters.size() - 4, 0), parqueListFilters.size());

但是在前端区域进行过滤之后,仍应在应用程序的后端部分填充该变量.

But still that variable should be filled on the backend part of the application after a filtering has occured on the frontend zone.

public List<String> parqueListFilters = new ArrayList<String>() ;

public String getParqueListFilter() {
    return parqueListFilter;
}

public void setParqueListFilter(String parqueListFilter) {
    this.parqueListFilter = parqueListFilter;
    parqueListFilters.add(parqueListFilter);
}

这篇关于Primefaces 5.3中dataTable的filterValue始终为null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆