I am using PF 5.1. I want to filter Primefaces datatable (date column) by calendar set primefaces calendar here .
For older PrimeFaces versions the solution has to be implemented like in this answer, for newe versions the other answer contains the solution.
Basically, this can be achieved like this:
h:inputHidden
) in the filter facet to hide the default filter input fieldp:calendar
in the header facetonstart
replace the value of your hidden input by the value of the calendar. In oncomplete
use the client side API to filter your datatableNote that the p:calendar
is meant to be for client input of a date only. If you also need the correct time in your filter function consider using an additional TimePicker (e.g. http://www.primefaces.org/showcase-ext/sections/timePicker/basicUsage.jsf)
Edit: Actually, PrimeFaces calendar supports datetime in mode="datetime"
. I wasn't aware of this. See https://code.google.com/p/primefaces/issues/detail?id=648