Sunday, June 8, 2014

How to show wider year range in PrimeFaces Calendar

By default, the year range is 10 years before and 10 years after.

as shown above, this year is 2014, the year range can only in between 2004-2024.

to display wider range, need to enable the yearRange attribute.

<p:calendar id="pfc1"
    yearRange="c-50:c+10"
    showOn="button"
    navigator="true" />

with the above yearRange settings, the year can display up to 50 years before and 10 years after.
Meaning current year -50 and current + 10.


Done!!

LinkWithin

Related Posts Plugin for WordPress, Blogger...