khizAz khizAz - 1 month ago 12
Javascript Question

jquery Full Calendar: callback 'after' the calendar has loaded completely

Is there a callback in Adam Shaw's jquery full calendar which is called after the calendar has rendered completely?? I want to call the clientEvents function in that call back to get all the events on the client side. I tried doing this in viewDisplay, but it is called before the events are rendered and the clientEvents returns 0 events.

Answer

Actually you can add it by yourself. Update the function render in the fullcalendar.js like this

function render(inc) {
    if (!content) {
        initialRender();
        trigger('complete', null, true);
    }else{
        calcSize();
        markSizesDirty();
        markEventsDirty();
        renderView(inc);
        trigger('complete', null, true);
    }
} 

And add to the initial call callback function:

$('#calendar').fullCalendar({
         editable: true,
         complete: function() {alert('complete');}, 

or, as you wanted, you can access all events

    complete: function() {
        var events = $(this).fullCalendar('clientEvents');
        for(var i in events)
        {
            alert(events[i].title);
        }
    },