Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the year list in Primefaces' calendar component?

Do exist any way to set the year list of the calendar component of primefaces?

like image 241
Rhigo HR Avatar asked Apr 12 '13 15:04

Rhigo HR


2 Answers

for year list you can use navigator="true" attribute of primefaces in p:calendar tag and for year range c-100:c+100 (will show the year range starting from 100 years back to 100 years forward in future.

so code will look like

<p:calendar id="someid"  yearRange="c-100:c+100" navigator="true"/>
like image 66
Anubhav Avatar answered Sep 20 '22 21:09

Anubhav


If you need only a year list, you can do:

<p:calendar value="#{backingBean.date}" navigator="true" yearRange="-100" showOn="button" />

that wil show you a list with the current year, and one hundred years ago.

Regards

like image 7
DrakoFire Avatar answered Sep 24 '22 21:09

DrakoFire