问题描述
我正在使用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.
推荐答案
移除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 - 在点击按钮时删除事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!