renderEvent fails after call to removeEvents - FullCalendar
I am fairly certain that this is a bug. Once I call remove "removeEvents", no subsequent adds ("renderEvent") work, and the ones that do act like they have no "stickiness".
If I do the following:
- Initialize calendar.
- Add event A using
$("#calendar").fullCalendar( 'renderEvent', newEvent, true);
- Remove this event using
$("#calendar").fullCalendar( 'removeEvents', 12345);
- Add event B using
$("##calendar").fullCalendar( 'renderEvent', newEvent2, true);
Neither event A or B appears! Both events have different IDs, and what should happen is event A is deleted, but event should B appear. If I take this single "removeEvent" out, then both events A and B appear (even though the remove is only targeting the ID of event A).
Even if I rerender the events after step 4 using $("#calendar").fullCalendar( 'rerenderEvents' );
, still event B doesn't show.
What's more interesting is that this doesn't seem like simply a "rendering" issue since if I pull all events using $("#calendar").fullCalendar( 'clientEvents', ...);
, it doesn't show event A or B in the array of returned events, where as removing the "removeEvent" will allow both events A and B to appear in the array.
The solution would SEEM to be do the remove AFTER all of the adds:
- Add event A
- Add event B
- Remove event A
Which DOES keep event B, but in my app, I have drag-drop functionality, and the user can "add" new events at any time! So I am finding that as I call "removeEvent" then dragging a new event into the calendar makes the "stickiness" of the event go away, so change a month will not retain that added event.
Here is my code:
$('#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,
dro开发者_JAVA百科p: 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);
Even though this code deletes event with ID 12345, the OTHER event (id 4433) is also not shown. Removing the line ..."removeEvents"... causes both events to show.
Again, I can add new events, drag them, etc, and it works great. As soon as "removeEvents" is called once, then things start acting weird.
Help would be appreciated!
-Brian
I just upgraded from 1.4.9 to 1.4.10, cleared my cache and tried again, and it now looks like everything is working properly.
Hopefully that was it.
-Brian
精彩评论