renderEvent在呼叫removeEvents后失败 - FullCalendar
我相当确定这是一个错误。一旦我调用删除“removeEvents”,没有后续添加(“renderEvent”)的工作,而那些行为像他们没有“粘性”。renderEvent在呼叫removeEvents后失败 - FullCalendar
如果我做到以下几点:
- 初始化日历。
- 添加事件A使用
$("#calendar").fullCalendar('renderEvent', newEvent, true);
- 使用
$("#calendar").fullCalendar('removeEvents', 12345);
- 删除此事件中使用
$("##calendar").fullCalendar('renderEvent', newEvent2, true);
无论是事件A或B出现添加事件B!两个事件都有不同的ID,应该发生的事件是事件A被删除,但事件B应该出现。如果我将此单个“removeEvent”取出,则会显示事件A和B(即使删除仅针对事件A的ID)。
即使我在步骤4之后使用$("#calendar").fullCalendar('rerenderEvents');
重新渲染事件,仍然事件B不显示。
更有趣的是,这似乎不是一个简单的“渲染”问题,因为如果我使用$("#calendar").fullCalendar('clientEvents', ...);
拉动所有事件,它不会在返回的事件数组中显示事件A或B, “removeEvent”将允许事件A和B出现在数组中。
的解决方案似乎是做了之后删除所有的补充道:
- 添加事件A
- 添加事件B
- 删除事件A
其中DOES保持事件B,但在我的应用程序中,我具有拖放功能,用户可以随时“添加”新事件!所以我发现当我称之为“removeEvent”时,将新事件拖入日历会使事件的“粘性”消失,因此更改一个月不会保留该添加的事件。
这里是我的代码:
$('#calendar').fullCalendar({
theme: true,
header: {
left: "prev,next today",
center: 'title',
right: "today prev,next"
},
height: 400,
selectable: true,
selectHelper: true,
unselectAuto: false,
select: calendarSelect,
droppable: true,
drop: calendarDrop,
events:getCalendarData,
eventClick:calendarEventClicked
});
var newEvent = {
id: 12345,
period: "Full-day",
title: "Full-day",
start: new Date(2010, 11, 02),
type: "Regular",
billable: true,
className: "",
changedThisSession: true
};
$("#calendar").fullCalendar('renderEvent', newEvent, true);
$("#calendar").fullCalendar('removeEvents', 12345);
var newEvent2 = {
id: 4433,
period: "Full-day",
title: "Full-day",
start: new Date(2010, 11, 03),
type: "Regular",
billable: true,
className: "",
changedThisSession: true
};
$("#calendar").fullCalendar('renderEvent', newEvent2, true);
即使这个代码删除ID为12345,其他场次(编号4433)事件也未显示。删除行...“removeEvents”...导致显示这两个事件。
再一次,我可以添加新的事件,拖动它们等等,它很好用。只要“removeEvents”被调用一次,事情就会变得怪异。
帮助,将不胜感激!
-Brian
我刚刚升级从1.4.9到1.4.10,清除我的缓存,并试图再次,现在看起来一切正常。
希望就是这样。
-Brian