Javascript Fullcalendar - copying events
fullcalendar, javascript, jquery
Solution
Below is my solution that allows the user to hold shift key to copy events. Note that this is actually moving the original event and leaving a copy in the original position.
I started with this reference and created the following:
//Before the fullCalendar object
var copyKey = false;
$(document).keydown(function (e) {
copyKey = e.shiftKey;
}).keyup(function () {
copyKey = false;
});
//then inside the fullCalendar object
eventDragStart: function (event, jsEvent, ui, view) {
if (!copyKey) return;
var eClone = {
title: event.title,
start: event.start,
end: event.end
};
$('#calendar').fullCalendar('renderEvent', eClone);
},
Problem
I'm using Fullcalendar (http://arshaw.com/fullcalendar) in my project. It gets events via json source. I want to give the user option to copy one event on the calendar to other day - and I'd like to use dragging for that (well, that's the client's requirement). But dragging seems like moving an event, not copying - is there any way to get the "copy" of an event being dragged (or copy stay in original place), so it looks like a copy operation? I tried to copy event object in eventDragStart callback, but it didn't work.