How to use multiple sources with jQuery fullCalendar plugin?

I have a functional fullCalendar http://arshaw.com/fullcalendar/ that works with a single source from Google Calendar for events like this:

$('#calendar').fullCalendar({ events: $.fullCalendar.gcalFeed( "http://www.google.com/calendar/feeds/etc", // feed URL { className: 'gcal-events' } // optional options ) }); 

However, my task is to add multiple channels. The fullCalendar documentation says:

eventSources: Array Like the "event" parameters, except for one, you can specify multiple sources. For example, you can specify an array of JSON URLs, an array of user-defined functions, an array of hard-coded event arrays, or any combination.

But there is no example, so this new JSON newbie is a bit stuck.

Any ideas on what would need to use eventSources and an array of channels?

+6
jquery fullcalendar
source share
2 answers

found a solution here; http://code.google.com/p/fullcalendar/issues/detail?id=192&q=eventSources

 eventSources: [ 'msCal.txt', // location of Cal JSON script 'msLogBook.txt', // location of LogBook JSON object 'msEvents.txt' //location of the Events JSON object ] 

Painfully simple in retrospect. The following works on my test page:

 eventSources: [ $.fullCalendar.gcalFeed('http://www.google.com/calendar/feeds/en.australian%23holiday%40group.v.calendar.google.com/public/basic'), $.fullCalendar.gcalFeed('http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic'), $.fullCalendar.gcalFeed('http://www.google.com/calendar/feeds/en.indonesian%23holiday%40group.v.calendar.google.com/public/basic') ], 
+9
source share

I had the same problem and the idea above worked for me with a little modification. I needed to show 5 calendars per page, but only 1 calendar on another page, so that I do this.

 <?php if (is_page("calendar")):?> events:'...google calendar url #1...', <?php endif; ?> <?php if (is_page("meeting-schedule")):?> eventSources: [ $.fullCalendar.gcalFeed('...google calendar url #1...'), $.fullCalendar.gcalFeed('...google calendar url #2...'), $.fullCalendar.gcalFeed('...google calendar url #3...'), $.fullCalendar.gcalFeed('...google calendar url #4...'), $.fullCalendar.gcalFeed('...google calendar url #5...') ], <?php endif; ?> 

Works great !!!

+1
source share

All Articles