我正在使用支持資源的FullCalendar jQuery plugin
版本。在刪除外部事件時在FullCalendar上獲取資源ID
我按照this example拖動外部事件。
這一切工作得很好,但我找不到方法來獲取與外部事件已被刪除的單元格(日)關聯的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();
}
}
我非常感謝您對此問題的任何幫助。
你是什麼意思的'資源ID'?您是否在尋找事件發生地點的日期/時間? – ganeshk 2012-08-15 13:09:29
它看起來像'eventDrop'方法中的資源對象是可用的,但我認爲您需要自定義該插件以使其在'drop'中可用。 – cOle2 2012-08-15 20:13:54
謝謝Ganesh。 它是一個FullCalendar版本,允許資源列在左側 - 請參閱http://tux.fi/~jarnok/fullcalendar-resourceviews/ 每個資源都有一個ID和一個名稱。 其他所有工作都正常,但當外部事件發生時,我無法獲得相關資源的ID。 再次感謝。 – Nick 2012-08-15 20:59:19