Updates to fullcalendar events (through updateEvent) not maintaining across ajax month changes

Posted by user549615 on Stack Overflow See other posts from Stack Overflow or by user549615
Published on 2011-01-03T22:50:22Z Indexed on 2011/01/03 22:53 UTC
Read the original article Hit count: 377

Filed under:
|

Hey there.

I have the calendar configured to allow me to edit and add (drag/drop) calendar events. I use .fullCalendar('updateEvent', theEvent) to edit an event, and it immediately updates on the page. Excellent. If I move to another month and then move back (get via ajax), that change is undone. By contrast, if I add a new event by drag/drop using:

.fullCalendar('renderEvent', newEventObject, true);

it appears on the calendar, and if I move to another month, and move back, it maintains. If I edit this newly added event object, and move to another month and back, the updates are retained! So the "stickiness" of edits seem to work on newly added events, but not events that were pulled via ajax (since it just pulls a fresh version via ajax when the month changes).

My calendar config is:

$('#calendar').fullCalendar({
    theme: true,
    header: {
        left: "prev,next today",
        center: 'title',
        right: "today prev,next"
    },          
    selectable: true,
    selectHelper: true,
    select: calendarSelect,
    droppable: true,
    drop: calendarDrop,
    events:getCalendarData,
    eventClick:calendarEventClicked
});

I tried setting editable: true, as well, but no dice.

I noticed that if I view "event.source" on one of the ajax pulled events, it shows me a function, and if i read the source attribute on one of the "added" events, it reads [object]. So I tried setting the event.source of the event being added, to that same event object:

curCalendarEvent.source = curCalendarEvent

But no dice. It sets, but when I move back month forward again, it returns to the function as a source.

I tried adding lazyFetching: false to my calendar config, but that didn't help.

I even tried a .fullCalendar('renderEvent', curCalendarEvent, true); on the existing "edited" event to see if I could get "stick" to work, and it didn't help.

The only thing I can think of doing is deleting the event flat out and recreating it.

Any help would be appreciated.

-Brian

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about fullcalendar