Remove Elements from fullcalendar (by dragging to trash can)

前端 未结 5 1734
渐次进展
渐次进展 2020-12-29 11:32

I have a fullcalendar with external elements being dragged onto it. I\'m relatively new to jquery. I don\'t know quite how to get the ID of the object being dragged to a \

5条回答
  •  我在风中等你
    2020-12-29 12:30

    here is something I just did hope it helps. I dont know if you are using php/mysql but if your not just remove the ajax call and keep what is in the success function.

            $('#calendar').children('.fc-content').children().append('
    '); //listens for drop event $("#calendarTrash").droppable({ tolerance: 'pointer', drop: function(event, ui) { if ( dragged && ui.helper && ui.helper[0] === dragged[0] ) { var event = dragged[1]; var answer = confirm("Delete Event?") if (answer) { $.ajax({ url:'/employees/removeevent?id='+event.id, dataType: 'json', async: false, error: function(xhr, ajaxOptions, thrownError) { //console.log(xhr.status); //console.log(thrownError); }, success: function() { calendar.fullCalendar( 'removeEvents' , event.id ); } }); } } } }); eventDragStart: function( event, jsEvent, ui, view ) { dragged = [ ui.helper[0], event ]; },

提交回复
热议问题