如何获取在Primefaces的Filtered DataTable字段中输入的值? [英] How to get the values entered in the field Filtered DataTable of Primefaces?

查看:105
本文介绍了如何获取在Primefaces的Filtered DataTable字段中输入的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据表:

<p:dataTable id="pDataTableListaRegistros"
             var="registro"
             value="#{arquivoBean.listaRegistros}"
             paginator="true"
             rows="20"
             filteredValue="#{arquivoBean.filteredListaRegistros}"
             styleClass="tabelaCentralizada">

我想获取在过滤器字段"Code","Data do Registro"和Usuário"中输入的值,以便在支持bean中进行操作.

I would like to get the values ​​entered in filter fields "Code", "Data do Registro" and "Usuário" to manipulate in a backing bean.

推荐答案

您可以通过以下方式从数据表中获取过滤器值:

You can get the filter value from the datatable by

  1. 通过绑定或遍历树从视图获取对数据表的引用.通过绑定,您将拥有:

  1. Obtain a reference to the datatable from the view either by binding or walking the tree. By binding, you'll have:

   <p:dataTable binding="#{arquivoBean.theDataTable}" id="pDataTableListaRegistros" var="registro" value="#{arquivoBean.listaRegistros}" paginator="true" rows="20" filteredValue="#{arquivoBean.filteredListaRegistros}" styleClass="tabelaCentralizada"/>

在您的支持bean中:

And in your backing bean:

   DataTable theDataTable = new DataTable();
   //getter and setter

  • 来自绑定

  • From the binding

       Map<String, String> theFilterValues = theDataTable.getFilters(); //This returns a map of column-filterText mapping.
    

  • 这篇关于如何获取在Primefaces的Filtered DataTable字段中输入的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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