Calendar Navigation

UI Components for JSF
Post Reply
vjosullivan
Posts: 27
Joined: 29 Jan 2010, 12:05

16 May 2011, 12:03

(Primefaces 2.2)

I have a Calendar set up with yearRange="c-1:c+2". Last year, this year and the next two years.

Initially, the drop down correctly displays the years <2010, 2011, 2012, 2013>. If the user selects a the year 2013 and later decides to change the year again then the drop down displays <2012, 2013, 2014, 2015>. The Calendar always takes the current year as the year being displayed in the Calendar and not the actual year. How to I restrict the drop down to be based around the current year and not the last selected year?

Thanks,
Vince.
--- Primefaces; 2.2: Java; 1.5: JSF; 2.0: Apache Tomcat 6.0: ---
Last edited by vjosullivan on 17 May 2011, 10:07, edited 1 time in total.
[ Primefaces 2.2: Java 1.5: JSF 2.0: Apache Tomcat 6.0 ]

vjosullivan
Posts: 27
Joined: 29 Jan 2010, 12:05

17 May 2011, 10:06

Is there any documentation of the syntax for the yearRange attribute of the Calendar component? My copy of the documentation shows only the example "c-10:c+10". For my implementation I've used "c-1:c+2" to get a four year date range. Unfortunately, this date range appears to be based on the year displayed in the calendar component and not on the actual current year. Is there a syntax that uses the actual year?

Vince.
[ Primefaces 2.2: Java 1.5: JSF 2.0: Apache Tomcat 6.0 ]

vjosullivan
Posts: 27
Joined: 29 Jan 2010, 12:05

17 May 2011, 14:04

My copy of the documentation shows only the example "c-10:c+10". For my implementation I've used "c-1:c+2" to get a four year date range.
I think I may have solved the problem. I've change the yearRange attribute to "-1:+2" and this appears to work. The drop down always shows <2010, 2011, 2012, 2013> regardless of the year of the currently selected date.

Unfortunately, I cannot find the yearRange syntax documented in the User Manual, so I cannot be sure that this is a valid solution.

Vince.
[ Primefaces 2.2: Java 1.5: JSF 2.0: Apache Tomcat 6.0 ]

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 28 guests