Filter between filters between dates

I need to filter some fields between dates, but there is still no support for date filtering in flow meters.

I can do this with a function, but I'm not sure how ... here is some example I found:

<f:facet name="header">DateRange <div> <p:calendar id="from" value="#{bean.from}" styleClass="calendarFilter"> <p:ajax event="dateSelect" listener="#{ctrlr.filterDates()}" update="dataTableId"/> </p:calendar> <p:calendar id="to" value="#{bean.to}" styleClass="calendarFilter"> <p:ajax event="dateSelect" listener="#{ctrlr.filterDates()}" update="dataTableId"/> </p:calendar> </div> </f:facet> 

there is only the "view" code, id how to see how it will be a filter function in my bean.

any example is welcome :)

thanks.

+4
source share
1 answer

I would save the date fields in another output panel and, based on the date selection, update the table by clicking the filter button.

 <h:outputText value="FROM" /> <p:calendar id="strtdt" showOn="button" title="Start Date" size="12" value="#{form.startDate}" navigator="true" showButtonPanel="true"> </p:calendar> <h:outputText value="TO" /> <p:calendar id="enddt" showOn="button" title="End Date" size="12" value="#{form.endDate}" navigator="true" showButtonPanel="true" > </p:calendar> <p:commandButton id="btnFilter" value="Filter" update="datatable" action="#{controller.update()}" ajax="true" /> 

In the controller class, write code to retrieve the necessary data between dates and update the table (or the list that loads the table). Hope this helps.

+3
source

Source: https://habr.com/ru/post/1484099/


All Articles