Issue 1052: 1.5 Extended function can't load
Status:  Done
Owner: ----
Closed:  Aug 2011
Reported by andy...@gmail.com, Jul 26, 2011
I use this method to retrieve my multiple source events:

http://arshaw.com/fullcalendar/docs/event_data/events_function/

$('#calendar').fullCalendar({
    eventSources: [
        // your event source
        {
            events: function(start, end, callback) {
                // ...ajax first source retrieve
            },
        },
        {
            events: function(start, end, callback) {
                // ...ajax second source retrieve
            },
        }
    ]
});

If the 2 sources as above contains events, it will load in the calendar. However, if one of the sources contains 0 record,  all the events doesn't load. A bug?
Jul 26, 2011
#2 andy...@gmail.com
I think I found out what is the issue. My ajax function goes like this:

                     success: function( res ) {
                        var obj = $.parseJSON( res );
                        if( obj.bool == 1 ) {
                            var events = [];
                            for( var i=0; i<obj.data.length; i++ ) {
                                events.push({
                                    id: obj.data[i]['id'],
                                    title: obj.data[i]['title']
                                });
                            }
                            callback(events);
                        }
                    }

If there is no result, it doesn't calls the callback function and hence causes all other events from other sources do not load. Once I move out the callback function of the if( obj.bool == 1 ) it works fine. I think the documentation should highlight the fact that the "callback" MUST be called regardless of whether there are any results.
Jul 26, 2011
#3 andy...@gmail.com
Though I find this strange as one source shouldn't affect the other...
Jul 29, 2011
Project Member #4 althaus.it
(No comment was entered for this change.)
Status: Discussing
Aug 21, 2011
Project Member #5 adamrs...@gmail.com
glad you figure it out.

internally, fullcalendar waits for all event sources to return events before attempting to render events. since your callback isn't being called, fullcalendar sees the event source as taking forever.
Status: Done