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

0


a source to share


3 answers


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.

+1


a source


You can turn off "nextMonth click" because you really want to restrict input to a specific date at the top. If so, you can set the maximum date value using the calendar API.



0


a source


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");

      

0


a source







All Articles