简体   繁体   English

fullcalendar-删除拖动的外部事件

[英]fullcalendar - remove dragged external events

I'm using a variation of the FullCalendar external dragging demo, found here: 我使用的是FullCalendar外部拖动演示的变体,位于此处:

http://fullcalendar.io/js/fullcalendar-2.1.1/demos/external-dragging.html http://fullcalendar.io/js/fullcalendar-2.1.1/demos/external-dragging.html

What I'm trying to achieve is being able to remove an event that you added through external dragging by double clicking it. 我要实现的目的是能够通过双击鼠标来删除通过外部拖动添加的事件。 Something like this: 像这样:

              $('.fc-event').dblclick(function(){
                   $('#calendar').fullCalendar( 'removeEvents' );
                  });

Now this will work... at removing all of the events. 现在,这将起作用...删除所有事件。 removeEvents's documentation can be found here: removeEvents的文档可以在这里找到:

http://fullcalendar.io/docs/event_data/removeEvents/ http://fullcalendar.io/docs/event_data/removeEvents/

Essentially, the problem is that I can't have something like this: 本质上,问题是我不能有这样的东西:

              $(**idOfTheEvent**).dblclick(function(){
                   $('#calendar').fullCalendar( 'removeEvents', **idOfTheEvent** );
                  });

because there may be many of the same events. 因为可能有许多相同的事件。 By having multiple "Event 2"s, for example, double clicking on one of them would remove them all. 例如,通过具有多个“事件2”,双击它们之一将全部删除。 So that's out. 这样就可以了。

What I'd like to have is something like: 我想要的是这样的:

              $(.this).dblclick(function(){
                   $('#calendar').fullCalendar( 'removeEvents', .this );
                  });

utilizing "this". 利用“这个”。 However, this wouldn't work either since I can only use event objects or IDs within removeEvents's parameters. 但是,由于我只能在removeEvents的参数内使用事件对象或ID,因此这都不起作用。 So I'm at a bit of a loss. 所以我有点茫然。

Any help would be much appreciated. 任何帮助将非常感激。

try to use eventClick native event from fullcalendar. 尝试使用fullcalendar中的eventClick本机事件。 With this you have access to id of the specific element that you're clicking 使用此功能,您可以访问要单击的特定元素的ID

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM