3

我正在使用FullCalendar jQuery plugin支持资源的版本。

按照这个例子,我正在拖入外部事件。

这一切都很好,但我找不到一种方法来获取Resource ID与外部事件已被丢弃的单元格(天)相关联的那个。

我正在使用下面的拖放功能。

drop: function(date, allDay) { 
    // 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;
    copiedEventObject.allDay = allDay;

    // 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);

    // is the "remove after drop" checkbox checked?
    if ($('#drop-remove').is(':checked')) {
        // if so, remove the element from the "Draggable Events" list
        $(this).remove();
    }
}

我将非常感谢您对此提供任何帮助。

4

1 回答 1

1

我也使用 FullCalendar 的这个分支,当你删除一个事件时可以获得资源 ID,如下所示:

drop: function(date, allDay, test3, test4, resource) {          
    var originalEventObject = $(this).data('eventObject');
    var copiedEventObject = $.extend({}, originalEventObject);
    copiedEventObject.start = date;
    copiedEventObject.allDay = allDay;
    copiedEventObject.resource = resource.id;

    $('#calendar').fullCalendar('renderEvent', copiedEventObject, true);
                
    if ($('#drop-remove').is(':checked')) {
        $(this).remove();
    }
}

所以,你应该将参数传递resourcedrop函数,你可以通过调用来获取资源ID resource.id

于 2013-06-07T06:54:21.793 回答