2013-05-01 92 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');