2015-08-14 28 views
0

因此,當拖動一個JQuery Draggable到FullCalendar JQuery插件的日曆時,我得到一個奇怪的空白重複。我得到一個空白的重複事件拖入一個事件與日曆FullCalendar JQuery插件

當我將「數據事件」添加到我試圖拖入日曆中的其中一個事件時,就會發生這種情況。

這裏是我得到的圖像:http://cl.ly/image/1t3c0Y2i1p0o

而且我的代碼:

drop: function(date) { // this function is called when something is dropped 

        // retrieve the dropped element's stored Event Object 
        var originalEventObject = $(this).data('eventObject'); 

        // we need to copy it, so that multiple events don't have a reference to the same object 
        var copiedEventObject = $.extend({}, originalEventObject); 

        // assign it the date that was reported 
        copiedEventObject.start = date; 

        // render the event on the calendar 
        // the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/) 
        $('#calendar').fullCalendar('renderEvent', copiedEventObject, true); 

        $(this).remove();     

       } 

回答

0

我解決了這個通過簡單地在我通過ID屬性所需的ID傳遞,然後檢索該在代碼內如下所示:

the_event_id = $(this).attr('id'); 
copiedEventObject.id = the_event_id.replace('event_',''); 

完全繞過數據事件屬性。

相關問題