I am using Fullcalendar 4 and have a problem refeching events. I am changing the event source with a dropdown menu but I can only refetch events that are stored in json, not events that have been dragged dynamically. I am using the following code.
calendar.destroy();
var eventSources = calendar.getEventSources();
var len = eventSources.length;
for (var i = 0; i < len; i++) {
eventSources[i].remove();
}
var url = './demo2/contents/calendar/get.php?source='+source;
calendar.addEventSource(url);
calendar.refetchEvents();
calendar.render();
How can I add all dragged events to a new source using eventReceive?
eventReceive: function(info) {
calendar.addEvent(event, [, source ]);
},
The external list is generated with the below code, I tried to specify the source location but doesnt seem to work when I drag and drop from the external list:
var initDrag = function(el,value) {
var eventObject = {
id: el.attr("data-id"),
startEditable: true,
allDay: false,
durationEditable: true,
title: $.trim(el.text()), // use the element's text as the event title
stick: true, // maintain when user navigates (see docs on the renderEvent method)
classNames: [el.attr("data-color"),],
description: 'Lorem ipsum dolor eius mod tempor labore',
source: 'planificacion'
};
// store the Event Object in the DOM element so we can get to it later
el.data('event', eventObject);
};