Reputation: 1846
Why can't a removed event be re-added to FullCalendar if it was part of the original events array?
This works (http://jsfiddle.net/fTu98/1/):
// A simple event object
e = {id: 1, title: 'a', start: Date.now()/1000 };
// Create calendar with no events
$("#calendar").fullCalendar({ events: [] });
// Add event to calendar
$("#calendar").fullCalendar('renderEvent', e);
// Remove event from the calendar
$("#calendar").fullCalendar('removeEvents', 1);
// Re-add event
$("#calendar").fullCalendar('renderEvent', e);
While this doesn't (http://jsfiddle.net/BNmrQ/2/):
// A simple event object
e = {id: 1, title: 'a', start: Date.now()/1000 };
// Create calendar with the event
$("#calendar").fullCalendar({ events: [e] });
// Remove event from the calendar
$("#calendar").fullCalendar('removeEvents', 1);
// Try re-adding event, doesn't work!
$("#calendar").fullCalendar('renderEvent', e);
I guess the documentation for renderEvent
hints at this by saying that it "Renders a new event on the calendar," but I don't understand why that's the case.
Thanks!
Upvotes: 1
Views: 796
Reputation: 2725
this bug has been resolved in version 2.0.0 of FullCalendar: https://code.google.com/p/fullcalendar/issues/detail?id=1997
Upvotes: 1
Reputation: 5745
I don't have an answer to "Why" but I can show you a work around
if you copy the event object into another object it will work (using the new object)
e2 = $.extend({}, e);
Upvotes: 1