[ 4 posts ]

Andrew Philllips

  • Username: AndyPhillips82
  • Joined: Tue Feb 14, 2012 9:48 am
  • Posts: 7
  • Offline
  • Profile
Tags:

Calendar Events for PrevMonth and NextMonth Buttons?

Post Posted: Wed Feb 15, 2012 10:45 am
+0-
Hi,

I'm trying to accomplish the following. With an minDate in September and maxDate in April, I want the months arrows to toggle to disabled when each month is reached.

I tried using the prevMonthClick and nextMonthClick, but they seem to be designated for something else.

Any ideas?

thx so much.

Allen Rabinovich

YUI Developer

  • YUI Developer
  • Offline
  • Profile

Re: Calendar Events for PrevMonth and NextMonth Buttons?

Post Posted: Wed Feb 15, 2012 4:56 pm
+0-
Hi Andrew,

That feature is not implemented yet (but is definitely on the radar, along with a slew of other options for calendar controls); the easiest thing to do would be to listen to the date change event in calendar, and when it hits either the minimumDate or maximumDate, to add a class to either the previous month or next month control that would change its appearance and disable hover behavior. You can then remove that class from either arrow when the date you hit is not either maximumDate or minimumDate).

Helpful methods: Y.one("yui3-calendarnav-nextmonth") and Y.one("yui3-calendarnav-prevmonth") will get you the nodes corresponding to the control arrows; Y.one("...").addClass and removeClass will add and remove CSS classes for the nodes; and Y.DataType.Date.areEqual(date1, date2) can compare two dates (although you can just compare the month and the year).

Allen Rabinovich

YUI Developer

  • YUI Developer
  • Offline
  • Profile
Tags:

Re: Calendar Events for PrevMonth and NextMonth Buttons?

Post Posted: Wed Feb 15, 2012 4:59 pm
+0-
The event from calendar that you want is 'dateChange', and it will have newVal and prevVal in the event payload -- newVal is the latest value displayed by the calendar. Keep in mind that for a multipane calendar, when the calendar hits maximumDate, this value will actually be (number-of-panes-1) smaller than the maximumDate (since maximumDate controls the highest month displayed, and 'date' always corresponds to the leftmost month displayed).

Andrew Philllips

  • Username: AndyPhillips82
  • Joined: Tue Feb 14, 2012 9:48 am
  • Posts: 7
  • Offline
  • Profile

Re: Calendar Events for PrevMonth and NextMonth Buttons?

Post Posted: Thu Feb 16, 2012 9:43 am
+0-
Yup, thanks, exactly what I was looking for.

I love the quick responses here!
  [ 4 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum