Issue 300: Javascript error when resizing the calendar or changing view (when events are displayed)
Status:  Done
Owner: ----
Closed:  Feb 2010
Reported by alessio....@gmail.com, Jan 22, 2010
Hi, thank you so much for this useful plugin!
I am using it for an internal project and it's great.

I found a couple of bugs though and I was wondering if someone else spotted them too:
Put the calendar in a fluid design, make sure that at least 1 event is currently displayed and 
try to resize the window.
It throws a "event.className.join is not a function" error on line 1295.

As a temporary fix I replaced the following (line 1295):
eventElement = $("<div class='" + className + event.className.join(' ') + "' />")

with this:
var evClass=(typeof event.className=="string")?event.className:event.className.join(" ");
eventElement = $("<div class='" + className + evClass + "'/>")

Same problem when switching to Week view (when the week contains events) on line 1944, and on Day 
view (with events) on line 1852.
Same temporary fix for both.

Hope this could help.
Thanks again
Alessio
Jan 22, 2010
#1 alessio....@gmail.com
I forgot to mention that I assigned a custom value to the Event object className 
property.
Jan 22, 2010
#2 alessio....@gmail.com
Confirmed; the error is thrown only if a custom className is defined for the Event 
object.
Feb 5, 2010
Project Member #3 adamrs...@gmail.com
thanks for the bug report alessio. i am having trouble recreating it though. can you 
please post a zip file with a working example of the bug? thanks
Feb 8, 2010
#4 alessio....@gmail.com
Hi,
I attached my test page showing the bug. To reproduce it please make sure that at 
least one event is currently displayed (use the top left panel to add events).
As soon as the window is resized you should get the error.

The code is a bit messy; I hope I'll have no problems with it ;)

Thanks for the great work!
Cheers
Ale
calendar.zip
826 KB   Download
Feb 9, 2010
Project Member #5 adamrs...@gmail.com
Hello,
I was able to reproduce the problem. I wasn't able to figure out exactly where the problem was 
occurring, but i did figure out the general reason.

look at my zip. at around line 527 in basic-views.js, you are filtering events from 
eventsCalendar.dataStorage.eventsList into the fullcalendar events callback. cloning each event 
solved the problem. there must be other parts of your code that are manipulating 
eventsCalendar.dataStorage.eventsList after this happens (i can't figure out where though).

wherever that point in your code is, its probably reseting the className of each event. 
internally, fullcalendar converts the className property to an array. it doesn't expect it to 
change after the first time.

your code is keeping references to each event, which is error-prone, because fullcalendar 
expects to be the sole owner of the reference (otherwise, fullcalendar would have to copy 
*every* event's info... a performance hit)

please let me know if this makes sense.
calendar_ashaw.zip
835 KB   Download
Feb 26, 2010
Project Member #6 adamrs...@gmail.com
(No comment was entered for this change.)
Status: Done
Feb 26, 2010
#7 alessio....@gmail.com
Hi,
yes this makes a lot of sense, thank you.
I am going to rewrite that part; I was wondering whether my fix could be considered a 
temporary work around (apart from the performance issue) or if you can foresee some 
hidden "side effects".

Cheers