Thursday, 12 September 2013

FullCalendar: How to re-add events that were part of original events array?

FullCalendar: How to re-add events that were part of original events array?

Why can't a removed event be re-added to FullCalendar if it was part of
the original events array at calendar creation?
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);
Thanks!

No comments:

Post a Comment