I'm loading HTML with jQuery get()
, and creating a FullCalendar (v5.10.2) in the loaded content.
If I load this HTML content (with my FullCalendar being initialized) multiple times, eventReceive
will also be called multiple times when I drop external events, as if the eventHandler for previous FullCalendar instances stays in memory despite the object being de-referenced.
So I've looked into destroy()
and delete
in an attempt to clear any old fullCalendar data. No errors when calling the commands, but still eventReceive
is called multiple times. Also tried looking into replace
which some recommend, but still no luck.
Despite manually calling destroy()
on the active FullCalendar before loading a new one, eventRecieve
from previous FullCalendar instances are still fired, it seems.
For some odd reason it only seems to apply to eventReceive
though, and not other eventHandlers. It doesn't happen for eventDrop
nor eventResize
for example.
Anyone got any ideas on this? Thanks.
I was creating new FullCalendar.Draggable()
every time I loaded the FullCalendar. I didn't realize that should only be done once, and that it would subsequently automatically convert new elements to draggables.