如何从FullCalendar中删除此事件? [英] How do I delete this event from FullCalendar?

查看:179
本文介绍了如何从FullCalendar中删除此事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

日历可以让用户在日历上拖动一个时间段,但是我希望他们能够在点击日历时将其删除。



eventClick我有这个功能:
$ b $ pre $ function(calEvent){
removeRequestedEvent($(this),calEvent);
},

它只是传入日历事件和日历本身。

  removeRequestedBooking:function(cal,calEvent){
if(!confirm(Delete?))
return ;

cal.fullCalendar(removeEvents,calEvent.id);
cal.fullCalendar(rerenderEvents);

//重新显示可拖动元素
$(#requests#+ calEvent.id).show();
}

我也试过使用过滤器,但是在return语句上有一个断点

$ b $> $ code> cal.fullCalendar(removeEvents,function(event){
return event.id = = calEvent.Id;
});

有什么想法? (我知道Id是对的,最后一行是)。 Firebug在javascript中不显示任何错误。



我使用FullCalendar v1.4.10

解决方案



解决方案

在使用传入的cal的情况下,您可以尝试使用对包含日历的div的调用吗? eventClick 指根据我在文档中阅读的内容查看事件的HTML。


The calendar lets the user drag a timeslot onto the calendar, however I would like them to be able to remove it if they click on it.

So in the eventClick I have this function:

function (calEvent) {
  removeRequestedEvent($(this), calEvent);
},

It just passes in the calendar event and the calendar itself.

removeRequestedBooking: function (cal, calEvent) {
    if (!confirm("Delete?"))
        return;

    cal.fullCalendar("removeEvents", calEvent.id);
    cal.fullCalendar("rerenderEvents");

    // Re-show draggable element
    $("#requests #" + calEvent.id).show();
}

I've also tried using a filter, but a breakpoint on the return statement is never hit.

    cal.fullCalendar("removeEvents", function (event) {
        return event.id == calEvent.Id;
    });

Any ideas? (I know the Id is right, and the last line works). Firebug doesn't show any errors in the javascript.

I'm using FullCalendar v1.4.10

解决方案

Instead of using your passed in cal, can you try using a call to the div that holds your calendar?

In the case of eventClick, this refers to the HTML for the event according to what I'm reading in the docs.

这篇关于如何从FullCalendar中删除此事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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