YUI Calendar: How to Disable Next Click
The YUI calendar header has left / right arrows (links) that change the current month. I would like to disable the click event for these links. I tried using changePageEvent (), but it happens after the month has changed. YAHOO.util.Event.removeListener doesn't seem to work (maybe I'm doing it wrong).
thanks
a source to share
If changePageEvent () fires too late, why not do a simple exit? Add the following to your stylesheet so the buttons won't show at all:
.yui-calendar .calnavleft, .yui-calendar .calnavright{ display:none; }
If this is not what you want, you can physically remove events using:
YAHOO.util.Event.removeListener(yourCalendarObject.linkLeft,'click');
YAHOO.util.Event.removeListener(yourCalendarObject.linkRight,'click');
But the buttons will still display and because YUI uses the href from "#" on those links, your page will jump up. You will need to apply CSS to hide them anyway.
a source to share
You will need to change the style after rendering the calendar.
I did the following and the previous and next buttons were no longer showing:
...
companyCalendar.render();
...
var Dom = YAHOO.util.Dom;
var navLeft = Dom.getElementsByClassName("calnavleft", "a", "companyCalendarContainer")[0];
var navRight = Dom.getElementsByClassName("calnavright", "a", "companyCalendarContainer")[0];
// hide the existing nav buttons
Dom.setAttribute(navLeft, "style", "display: none");
Dom.setAttribute(navRight, "style", "display: none");
a source to share