简体   繁体   English

primefaces filterby函数没有结果

[英]primefaces filterby function gives no results

I am trying to filter a datatable by adding the following code: 我试图通过添加以下代码来过滤数据表:

<p:dataTable value="#{hoofdschermBean.onderzoekers}" widgetVar="onderzoekerTable" var="onderzoekeritem" rendered="#{not empty hoofdschermBean.onderzoekers}" rowStyleClass="tablerow" draggableColumns="true">
<f:facet name="header">
    <p:outputPanel>
        <h:outputText value="Zoeken:" />
        <p:inputText id="globalFilter" onkeyup="PF('onderzoekerTable').filter()" style="width:150px" placeholder="Enter keyword"/>
    </p:outputPanel>
 </f:facet>

However it does not filter when I fill something in this textbox, it says no records found. 但是,当我在此文本框中填写内容时,它不会过滤,显示找不到记录。 If I add filterBy on a column, only than this textbox can filter on the column variable. 如果在列上添加filterBy,则只有此文本框可以在列变量上进行过滤。 What am I doing wrong here? 我在这里做错了什么?

(PS I do not want to have filter functions on every separate column, that is why I wanted this facet only!) (PS我不想在每个单独的列上都具有过滤器功能,这就是为什么我只想要这个方面!)

@Edit 14:32 27-11-2014 I have also tried to use @Edit 14:32 27-11-2014我也尝试使用

filteredValue="#{hoofdschermBean.gefilterdeOnderzoekers}"

and to use ViewScoped and SessionScoped. 并使用ViewScoped和SessionScoped。

Do you have a List<> field in your managedBean so the filtered values can be saved somewhere? 您的managedBean中是否有一个List <>字段,以便可以将过滤后的值保存在某处? Also, you'd need to reference this value with a filteredValue="#{hoofdschermBean.filtered...}" attribute in your dataTable-Tag. 另外,您需要在dataTable-Tag中使用filteredValue="#{hoofdschermBean.filtered...}"属性来引用此值。

(Like in the PrimeFaces ShowCase, where they have a List<Car> filteredCars; in their managedBean) Also, it might be helpful to check the scope of your ManagedBean (就像PrimeFaces ShowCase一样,在他们的ManagedBean中有一个List<Car> filteredCars; )此外,检查ManagedBean的范围可能会有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM