YUI: Problem with using a loop to addRenderer on CalendarGroup

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?


Share Send to a friend Watch Report
 
 

2 Posted Answers
Order by

 
17 helpful answers

Satyen pointed out my code error on the

ydn-javascript list, he also posted a fixed version of my code. It was me being dumb - should be buildDate.length not buildDate.length()
Posted 2007-10-29T21:37:19Z

Sign in to participate

Got an answer for robertc? Would you like to comment on the posted answers, or vote for the one which you think is the best?

Sign up for a free account, or sign in (if you're already a member).

Explore Related Questions

Other people asked questions on similar topics, check out the answers they received:


Q:

What are web 2.0 marketing techneques

What are web 2.0 marketing techneques
Submitted by iwebmaster   2 years ago.
  • viewed 1756 times
Last answer posted 17 days ago by Frank



» More...

Explore Related Posts in Forums

WEB 1.0 and WEB 2.0

Hello friends Today many of them are creating the website in WEB 1.0 or Web 2.0 . I have found a nice article on Web 1.0 and Web 2.0 differences which could help you in distinguishing between them... that it matters, we could be at web five-million point three. CodeJoust! Design + Development - Proud

Spring Web Flow 2.0 M4 Released

To provide your feedback on M4 to the development team. Enjoy! 2.0 final is right around the corner. that Spring Web Flow 2.0 M4 is now available. Download | Documentation This release firms up the Web... (we could definitely use the DOJO integration) into our app (currently in development) and run

What is Web 2.0?

An interesting topic on Web 2.0 Source : http://www.oreillynet.com/pub/a/orei...20.html?page=1 basically a comparision of the older web 1.0 and web 2.0 . development. I already marked some time to learn this technologies some weeks ago. quite interesting topic
» More...
Powered by
Feed - Subscribe to changes to this Q&A Blog
ADVERTISEMENT
ADVERTISEMENT
AOL Autos Q&A is powered by Yedda an AOL Company
Copyright © 2006-2009, Yedda Inc. and respective copyright owners