First, I've seen this: Fullcalendar V4 - clear all events
But the docs for 'remove()' say: Removes all events associated with this source and prevents it from being fetched again.
If I do this:
$("#possibleStaff").on('change', function(){
var sources = calendaring.calendar.getEventSources();
sources[0].remove();
calendaring.calendar.refetchEvents();
});
The refetchEvents is ignored.
Is there a clear everything without removing the source
command?
The particular problem I'm trying to work around is if I add an event and then refetchEvents, the added event is still present until I completely reload the page. That's why I'm looking for a 'clear-all'.
Current work around:
calendaring.clearAll = function(){
$.each(calendaring.calendar.getEvents(), function(key, event){
var thisEvent = calendaring.calendar.getEventById(event.id);
if(thisEvent) {
thisEvent.remove();
}
})
};