Dominique
Dominique

Reputation: 81

Dropping onto an event (as opposed to the calendar) - how to identify event?

I have successfully implemented dragging of a jquery-ui element onto my fullCalendar. The problem is that what I want to drop onto is not the calendar itself but a specific event displayed on the calendar in order to add the dropped item to the event. The missing piece is how to identify the event that was under the mouse when I dropped.

drop: function (date, allDay, jsEvent, ui)
{
   var event = ???;
   event.description += ui.helper.data("filters").text;
   $('#calendar').fullCalendar('updateEvent', event);
}

Upvotes: 2

Views: 1343

Answers (2)

jeremyj11
jeremyj11

Reputation: 714

I just implemented this - thankyou for your solution!

I'm using it in combination with drop - I need to be able to drop events either onto another event or onto a date.

In my case adding event.stopPropogation(); in element.droppable drop is necessary to stop the date drop function from also triggering.

Upvotes: 0

Dominique
Dominique

Reputation: 81

I've discovered the solution. Basically you have to add "droppable" to the event element. I do this by catching the "eventRender" (I assume this is a good spot)...

eventRender: function (event, element)
{
    // store the ID for later...
    $(element).data('id', event.id);
    element.droppable({
        drop: function (event, ui)
        {
            // get the ID I stored above...
            var rowID = $(this).data('id');

Upvotes: 6

Related Questions