Jquery fullCalendar-使用removeEvents删除多个事件ID
我正在使用fullCalendar管理多个员工的轮班计划。出于筛选目的,我希望根据所选的用户ID从中删除事件。对于每个用户,都有一个提供此ID的按钮 目前我是这样做的:Jquery fullCalendar-使用removeEvents删除多个事件ID,jquery,ajax,fullcalendar,Jquery,Ajax,Fullcalendar,我正在使用fullCalendar管理多个员工的轮班计划。出于筛选目的,我希望根据所选的用户ID从中删除事件。对于每个用户,都有一个提供此ID的按钮 目前我是这样做的: $.ajax({ url: "./_res/json/getWorkTime.php", //selects events accoring to the selected user type: "POST", dataType: "json", //data comes as json da
$.ajax({
url: "./_res/json/getWorkTime.php", //selects events accoring to the selected user
type: "POST",
dataType: "json", //data comes as json
data: {
start: $("#calendar").fullCalendar("getView").start._d.dateFormat("Y-m-d"), //start date of the current view
end: $("#calendar").fullCalendar("getView").end._d.dateFormat("Y-m-d"), //end date of the current view
user: parseInt($(this).attr("id").replace("user_","")) //userID, coming from the selected button
}
}).done(function(ret) {
$.each(ret,function(index,value) { //due to the fact that removeEvents only processes one eventID, running over the result set
$("#calendar").fullCalendar("removeEvents",value.id); //getting eventID out of the result set an removing it
});
});
尽管要将事件从日历中渲染出来需要花费很长的时间,但这一点非常有效。从数字上看,这个脚本需要大约6秒钟来处理大约23个条目
我正在寻找一种更好、更有效的方法。有人有主意吗