contextMenu打破FullCalendar事件拖动 [英] contextMenu breaking FullCalendar event dragging
问题描述
contextMenu和事件回调代码:
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(你确定你wa nt删除这个事件?)){
$ .ajax({
url:'events /'+ event.id,
type:DELETE,
}) ,
$('#calendar')。fullCalendar('refetchEvents');
else if(action ==edit){
window.location ='events /'+ event.id +'/ edit'
}
}
);
$ b 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;
}
返回false;
这是不会得到答案我的解决方案是切换到一个不同的上下文菜单插件(http://www.trendskitchens.co.nz/jquery/contextmenu/)这是非常相似,并没有导致任何问题与全日历。这不是解决这个插件与完整日历工作有关的任何问题的解决办法,但它是修复程序,让我的程序正常运行。
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;
}
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.
这篇关于contextMenu打破FullCalendar事件拖动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!