如何在p:dateTable中使用datepicker进行过滤?

时间:2017-11-16 09:29:17

标签: jsf primefaces

我是使用primeFace的jsf中的新手。我正在尝试使用datepicker过滤DateTable。当我从datepicket过滤器工作中选择日期时,我创建了DateTable过滤器,但是当我从字段中删除文本时,过滤器仍处于活动状态。如何我可以修复这是我的代码来自xhtml。

<p:column headerText="Date" filterBy="#{example.date}" sortBy="#{example.date}" filterMatchMode="contains">                   

                   <f:facet name="filter">
                        <p:calendar  pattern="dd/MM/yyyy">
                          <p:ajax event="dateSelect"  oncomplete="PF('table').filter()"/>
                         </p:calendar>
                    </f:facet>

                    <h:outputText value="#{example.date}">
                    </h:outputText>

如何处理有关过滤器文本输入更改的事件?

1 个答案:

答案 0 :(得分:1)

我解决了添加事件&#34; onblur&#34;的问题。这是我现在的代码

 <f:facet name="filter"> 
<p:calendar pattern="dd/MM/yyyy" onblur="PF('table').filter()"> 
<p:ajax event="dateSelect" oncomplete="PF('table').filter()" />
</p:calendar> 
</f:facet>