Issue 889: refetchevents does not work for events as an array
Status:  Done
Owner: ----
Closed:  May 2011
Reported by eric3...@gmail.com, Apr 4, 2011
Say I call the calendar and point the events to an empty array.

$('#calendar').fullCalendar({

events:someEmptyArray;
};)

After the calendar has been intiated, I do something to populate that array.  Then say I create a button that calls the refetchevents method.
This does not update the calendar with the newly updated array.

However, this works for other sources such as a JSON.  Am I misunderstanding something?  
May 3, 2011
#1 oszkar.n...@gmail.com
I can replicate this issue on 1.5.1, if I have a local JS array as the event source, manipulate the array and then call 'refetchEvents' it won't re-fetch. Tried deleting all events then refetching, no good. Also tried adding the events array as a data source and wrap it inside 'eventSources', but still no luck.

As a workaround I am re-creating the whole calendar when something changes in the event array, but that is way too expensive probably. Any better approaches?
May 3, 2011
#2 eric3...@gmail.com
I found a better work around to this than recreating the calendar is to use removeEvents and then addEventSource

$('#calendar').fullCalendar('removeEvents');

$('#calendar').fullCalendar('addEventSource', eventsArray );	
	
May 3, 2011
#3 oszkar.n...@gmail.com
Ah, great - thanks for sharing!
May 8, 2011
Project Member #4 adamrs...@gmail.com
glad you came up with a solution.

this is a tricky issue because as soon as you reassign your someEmptyArray variable, fullcalendar has no way of knowing what the new reference is. this is more a javascript limitation than anything else.

oszkar, wraping the array in a data-source object is a smart thing to do, but it'd only work if you assigned it back to the `events property before rerendering.

at least i think that's what was going on.
Status: Done