So I recently added a context menu to the events in my FullCalendar using jQuery contextMenu (http://abeautifulsite.net/blog/2008/09/jquery-context-menu-plugin/). It works beautifully, except that my dragging/dropping ability stopped working properly, when you drag an event and let go over another date the event date isn't changed, and it redirects to the event's url. I did some checking, and realized that eventDrop, eventDragStart, and eventClick all aren't being fired. If I comment out the context menu everything works fine. If anyone can figure out why contextMenu is preventing the fullCalendar callbacks from being fired I'd appreciate it, since contextMenu suits my needs perfectly otherwise. Code for contextMenu and event callbacks:
eventRender: function(event, element) {
if (event.url.indexOf("https://www.google.com") != 0)
{
element.contextMenu({
menu: "myMenu",
},
function(action, el) {
if (action == "approve") {
$.ajax({
url: 'events/' + event.id,
data: { 'event' : { 'status' : "Approved", } },
type: "PUT",
}),
$('#calendar').fullCalendar('refetchEvents');
} else if (action == "deny") {
$.ajax({
url: 'events/' + event.id,
data: { 'event' : { 'status' : "Denied", } },
type: "PUT",
}),
$('#calendar').fullCalendar('refetchEvents');
} else if (action == "destroy") {
if (confirm("Are you sure you want to delete this event?") ) {
$.ajax({
url: 'events/' + event.id,
type: "DELETE",
}),
$('#calendar').fullCalendar('refetchEvents');
}
}
else if (action == "edit") {
window.location = 'events/' + event.id + '/edit'
}
}
);
}
},
eventDrop: function(event, dayDelta, minuteDelta, allDay, revertFunc){
updateEvent(event);
},
eventResize: function(event, dayDelta, minuteDelta, revertFunc){
updateEvent(event);
},
eventClick: function(event) {
if (event.url.indexOf("https://www.google.com") != 0) {
$.facebox(function() {
$.get('events/' + event.id,
function(data) {
$.facebox(data)
}
);
})
return false;
}
return false;
}
For those who don't want to change plugins, to fix the issue with the context menu mangling the dragability I modified jquery.contextMenu.js
From:
to
This stops the context menu plugin from doing anything on a left click, only on right click.
Well, since it looks like this isn't gonna get answered my solution was to switch to a different context menu plugin (http://www.trendskitchens.co.nz/jquery/contextmenu/) which was very similar and didn't cause any problems with Full Calendar. It's not a fix for whatever problem stops this plugin from working with Full Calendar, but it is a fix to get my program running properly.