Fullcalendar: draggable object rejects fullcalendar as droppable even though fullcalendar accepts drop

有些话、适合烂在心里 提交于 2019-11-30 18:42:27
Tats_innit

This may help you:

working version of drag and drop : http://jsfiddle.net/wkKfB/15/

Solution for dragobj = false is that you need to bind droppable event to the calendar so that draggable knows what DOM object is droppable see working example here: http://jsfiddle.net/CZQkm/3/ && http://jsfiddle.net/DEsdN/12/ *Until here

(Your version but with some tweaks. By the way I have jsfiddl-ed your issue here: http://jsfiddle.net/wkKfB/16/) (issue was binding the external event)

Good documentation reside here: http://arshaw.com/fullcalendar/docs/dropping/droppable/

Issue was you need to externally add these drag event.

You can change the css and make it to your use.

Quote *[From the documentation above around external drag and drop.]* http://arshaw.com/fullcalendar/docs/dropping/droppable/

>     How can I use this to add events???
>     
>     Good question. It is a common need to have an "external list of events" that can be dragged onto the calendar.
>     
>     While the droppable option deals with generic jQuery UI draggables and is not specifically tailored to adding events, it is possible to
> achieve this with a few lines of code. Follow the
> external-dragging.html example in FullCalendar's download. You can
> also view the example online.
>     
>     In short, you must call renderEvent yourself in the drop callback.

another link: http://arshaw.com/js/fullcalendar-1.5.3/demos/external-dragging.html

To capture the external event you need to add this code but the sample above has all set for you and should be clear

 /* initialize the external events
    -----------------------------------------------------------------*/
$('#external-events div.external-event').each(function() {

    // create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)
    // it doesn't need to have a start or end
    var eventObject = {
        title: $.trim($(this).text()) // use the element's text as the event title
    };

    // store the Event Object in the DOM element so we can get to it later
    $(this).data('eventObject', eventObject);

    // make the event draggable using jQuery UI
    $(this).draggable({
        zIndex: 999,
        revert: true,      // will cause the event to go back to its
        revertDuration: 0  //  original position after the drag
    });

});


/* initialize the calendar
-----------------------------------------------------------------*/
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!