I'm using the version of the FullCalendar jQuery plugin
that supports Resources.
I'm dragging in external events as per this example .
It all works very well, but I can't find a way to obtain the Resource ID
that's associated with the cell (day) onto which the external event has been dropped.
I'm using the drop function below.
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();
}
}
I'd be most grateful for any help on this one please.
I also use this fork of FullCalendar and it is possible to obtain Resource ID when you drop an event, like this:
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();
}
}
So, you should pass the parameter resource
to the drop
function and you could obtain the resource ID by calling resource.id
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.