fullcalendar-在eventRender之后删除删除的事件
我想使用fullcalendar将事件添加到数据库中,我的方法已经成功。但是,在日历中呈现事件后,会有两个类似的事件。一个已被删除,另一个已在成功的ajax请求后呈现 这是密码fullcalendar-在eventRender之后删除删除的事件,fullcalendar,Fullcalendar,我想使用fullcalendar将事件添加到数据库中,我的方法已经成功。但是,在日历中呈现事件后,会有两个类似的事件。一个已被删除,另一个已在成功的ajax请求后呈现 这是密码 drop: function(date, event) { var title = event.target.textContent; var start = date.format(); $.ajax({ url:
drop: function(date, event) {
var title = event.target.textContent;
var start = date.format();
$.ajax({
url: 'process.php',
data: 'type=new&title='+title+'&startdate='+start,
type: 'POST',
dataType: 'json',
async: false,
success: function(response){
$('#calendar').fullCalendar('renderEvent',response.eventblock,false);
},
error: function(e){
console.log(e.responseText);
}
});
console.log(event);
}
在成功块中,我使用renderEvent将事件添加到日历中。在ajax请求成功后,如何删除已删除的事件
首先,不推荐您添加事件的方式。基本上,您正在添加一个无源事件,这意味着您必须手动处理所有自动事件 但也许你有原因,艾德克 要使其工作,请提供事件id,然后使用
removeEvents
在添加具有相同id的事件时“删除”它们
我通过使用eventReceive来实现这一点,然后更新事件id。然后发布您的答案
success: function(response){
$('#calendar').fullCalendar(
'removeEvents', response.eventblock.id //or something like that
);
$('#calendar').fullCalendar(
'renderEvent', response.eventblock, false
);
}