2013-05-01 95 views
0

我在这里与FullCalendar有一个愚蠢的问题,一旦我运行我的回调函数事件消失的页面。FullCalendar jQuery插件,事件消失拖动

这是我的日历

var calendarSettings = { 
    selectable: true, 
    selectHelper: true, 
    editable: true, 
    events: '/ajaxCalenderEvents', 
    timeFormat: 'yyyy-MM-dd', 
    eventDrop: function(object){ 
     calendar.drop(object); 
     //console.log(object); 
    } 
} 

这是函数的eventDrop事件调用设置,

calendar = { 
    drop: function(o){ 
     o.start = $.fullCalendar.formatDate(o.start, 'yyyy-MM-dd'); 
     o.end = $.fullCalendar.formatDate(o.end, 'yyyy-MM-dd'); 
     $.post('/ajaxMoveDateRange', {data: o}, function(data){ 
     }, "json"); 
    } 
} 

然而,当我拖动事件,并把它,它完美地触发Ajax请求然而事件消失。

但是。

如果我这样做:

var calendarSettings = { 
    selectable: true, 
    selectHelper: true, 
    editable: true, 
    events: '/ajaxCalenderEvents', 
    timeFormat: 'yyyy-MM-dd', 
    eventDrop: function(o){ 
     o.start = $.fullCalendar.formatDate(o.start, 'yyyy-MM-dd'); 
     o.end = $.fullCalendar.formatDate(o.end, 'yyyy-MM-dd'); 
     $.post('/ajaxMoveDateRange', {data: o}, function(data){ 
     }, "json"); 
    } 
} 

,并有函数内联,它工作正常。

但是,我们使用的文件结构/模型意味着我们需要按照以前的格式对其进行格式化,调用外部函数。

有没有人知道这可能发生的任何原因?我试过返回true和东西,并围绕文档引出,但找不到任何东西,所以任何帮助,将不胜感激。

谢谢

+0

好吧,我已经收窄至$ .fullCalendar.formatDate(启动, 'YYYY-MM-DD');线。当我运行这个功能它清除日历... – Owen 2013-05-01 10:57:54

回答

0

有趣。 正如你所知,eventDrop与drop不一样。 eventDrop用于内部拖放已在日历上的事件,Drop则用于将外部事件拖放到日历上。

总之尽量

$.fullCalendar.formatDate(start, 'yyyy\'-\'MM\'-\'-\'dd');