Calendar min and maxdate

Components, Ajax Framework, Utilities and More.
bumblebee
Posts: 12
Joined: 06 Jul 2009, 13:04

06 Jul 2009, 13:12

Hi everyone,

i have some issues using the calendar component of PrimeFaces. I would like to use it as a 12 month overview of the year. For this i used the page attribute set to "12" and the mode set to "inline". Problem now, the calendar starts with the current date. I thought i can use the attribute mindate to manipulate but i had no success. My first question is, is it possible to use mindate to set the current calendar view to another month and second question how? In the tld mindate and maxdate are bind to java.lang.Object. Why not java.util.Date or java.lang.String?

Thanks in advance!

User avatar
optimus.prime
Prime
Posts: 17422
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

06 Jul 2009, 15:14

Hi, underlying widget supports what you need but the calendar component doesn't yet. The key is the pagedate feature which is not given an attribute yet.
For now as a quick workaround you can use the widgetVar extension.

Code: Select all

<p:calendar widgetVar="mycal" .../>

Code: Select all

<script type="text/javascript">
myCalendar.cfg.setProperty("pagedate","01/2009",false); 
</script>
This should start displaying calendar from january.

I've added an issue to add this attribute, it'll be shipped with 0.9.1.

bumblebee
Posts: 12
Joined: 06 Jul 2009, 13:04

07 Jul 2009, 08:46

Hey, thanks for your fast reply. I will try this. Another question is left. I miss the week of the year in the calendar. I think it's not implemented in the underlying widget neither. Do you plan to add the week numbers at the calendar?

User avatar
optimus.prime
Prime
Posts: 17422
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

07 Jul 2009, 10:32

Hi, What do you mean by week of the year? Where should it display it? There's a navigator to jump between dates.

bumblebee
Posts: 12
Joined: 06 Jul 2009, 13:04

07 Jul 2009, 14:46

Hey, i mean the numbers of the weeks. The year is divided into 52 weeks. There could be a column infront of the day view. For every row you would see a correspondent week number. Starting in january with the first week. This is, what i'm looking for.

User avatar
optimus.prime
Prime
Posts: 17422
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

07 Jul 2009, 15:36

As far as I know, it's possible with the widget. So called show_week_header or so, need to look into it.

bumblebee
Posts: 12
Joined: 06 Jul 2009, 13:04

07 Jul 2009, 17:45

Yes, you're right. There is a property called 'show_week_header'. It works fine. Thanks.

But I paste the whole JavaScript code of the yui calendar to the page, because i did not get the widgetVar attribute to work. I'm not sure where to find the solution now. I used your example like this...

Code: Select all

<p:calendar widgetVar="yahoo_calendar" ... />
...and later on the page i tried...

Code: Select all

<script type="text/javascript">
  yahoo_calendar.cfg.setProperty("pagedate", "01/2009", false);
  yahoo_calendar.cfg.setProperty("show_week_header", true);
</script>
This did not work for me. I use a facelet composition containing the PrimeFaces calendar followed by the JavaScript Tag. I debuged the site and recognized, that the JavaScript which should configure the jui calendar is called before the calendar is initialized from the PrimeFaces Tag. Maybe facelets runs first JavaScripts and after that the JSF tags will be handled. Actually this is exhausting me... Maybe you have a suggestion.

User avatar
optimus.prime
Prime
Posts: 17422
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

07 Jul 2009, 18:01

I guess you need to attach your javascript after document is loaded, this will guarantee variable "yahoo_calendar" to exist. Simplest way to do is ;

Code: Select all

<body onload=" yahoo_calendar.cfg.setProperty("pagedate", "01/2009", false);yahoo_calendar.cfg.setProperty("show_week_header", true);">
By the way I'll add this attribute to 0.9.1 release.

bumblebee
Posts: 12
Joined: 06 Jul 2009, 13:04

08 Jul 2009, 10:22

Thats great, thanks. Is there a releasedate yet for the next version? And do you plan an attribute to show the week header too?

User avatar
optimus.prime
Prime
Posts: 17422
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

08 Jul 2009, 10:43

Yes, next version is planned to be released in end of july. After the holiday period:) show_week_header and show_week_footer will be added for sure regarding your feedback.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: Baidu [Spider], Bing [Bot], mko and 13 guests