放弃事件(与日历相反) - 如何识别事件? [英] Dropping onto an event (as opposed to the calendar) - how to identify event?

查看:138
本文介绍了放弃事件(与日历相反) - 如何识别事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功地将jquery-ui元素拖到我的fullCalendar上了。问题是,我想要删除的内容不是日历本身,而是日历上显示的特定事件,以便将丢弃的项目添加到事件中。缺少的是如何识别掉掉鼠标时的事件。

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);
}


推荐答案

。基本上你必须添加droppable到事件元素。我通过捕捉eventRender(我认为这是一个很好的地方)来做到这一点...

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');

这篇关于放弃事件(与日历相反) - 如何识别事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆