I'm trying to use the Calendar component in the YUI toolkit.
I've got a calendar group, and I want to mark certain dates as
unavailable. Eventually, the set of unavailable dates will come from the server, but for now I'm just instantiating an array with some dates in.
I have a custom renderer as per the examples on developer.yahoo.com which I want to apply to all the dates in the array. Currently I have this code:
var i=0;
while (i < bookedDates.length()) {
YAHOO.swg.calendar.cal2.addRenderer(bookedDates[i], swgBookedRenderer);
i++;
};
Originally it was a for loop, but the effect is the same for either.
The problem is, with this code the calendar doesn't render. In
Firebug as I set through it leaps directly from 'while(i...' to line 8
of yahoo-dom-event.js and never actually executes the code. If I write out addRendered lines in full then everything works. I've put up an example page with both versions of the code, you'll see that only one calendar renders:
http://www.serviceworksglobal.com/questionnaire/test.html
I'm assuming there's something important I don't know about loops and YUI event handling, can anyone explain to me what it might be?