fullcalendar.js - 在点击按钮时删除事件 [英] fullcalendar.js - deleting event on button click

查看:1864
本文介绍了fullcalendar.js - 在点击按钮时删除事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用fullCalendar.js,目前的问题是让我失去了那么多时间,而这些东西对谁的理解javascript(更具体的jquery)来说可能比我更好。

I am using the fullCalendar.js and the current problem is making i lose so much time on something that might be simple to whose understand javascript (more specific jquery) better than me.

我的示例的链接位于底部,但我主要关注的是这部分内容:

The link of my example is at the bottom but my main concern is this part:

eventClick: function(event){
  $(".closon").click(function() {
     $('#calendar').fullCalendar('removeEvents',event._id);
  });
},    

我想用我的关闭按钮从日历中删除一个事件,而不是直接点击该事件。我已经尝试过在事件触发器之外使用 $ element.click ,但它关闭了日历上的所有事件,并且我可以达到的最大值是这种糟糕的情况,用户需要点击日历事件中的第一个,然后在'X'之后删除它。

I want to delete an event from the calendar with my close button and not on direct click of the event. I already tried using the $element.click outside of the eventClick trigger but it closed all the events on the calendar and the max i could reach was this poor situation, where the user need to click first on the calendar event and after on the 'X' to delete it.

http://jsfiddle.net/59RCB/49/

推荐答案

移除eventClick函数并用此替换eventAfterAllRender函数:

Remove the eventClick function and replace the eventAfterAllRender function with this:

        eventRender: function(event, element) {
            element.append( "<span class='closeon'>X</span>" );
            element.find(".closeon").click(function() {
               $('#calendar').fullCalendar('removeEvents',event._id);
            });
        }

这篇关于fullcalendar.js - 在点击按钮时删除事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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