views:

91

answers:

1

So I want to be able to specify multiple different sources for my FullCalendar implementation, I've got a number of Google Calendar feeds I want in my calendar but also a number of local feeds, all of which use the JSON datatype.

I figured I could mix the sources like this:

eventSources:
[
    $.fullCalendar.gcalFeed('http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic'),
    '/?module=a&controller=b&action=getJSON&id=1'        
]

But when I try this nothing is drawn on the calendar, not even the Google feed.

Can anyone tell me how I can specify multiple sources, from different locations (Google / local)

A: 

Okay so I've actually come up with a solution myself... Actually this first solution is not the solution, scroll down to the edit.

<script type="text/javascript">
    $(document).ready(function() {
        $('#calendar').fullCalendar({ events: "/?module=1&controller=2&action=getJSON&id=1" })
                      .fullCalendar({ events: "/?module=1&controller=2&action=getJSON&id=2" })
                      .fullCalendar({ events: "/?module=1&controller=2&action=getJSON&id=3" })
                      .fullCalendar({ events: "/?module=1&controller=2&action=getJSON&id=4" })
                      .fullCalendar({ events: $.fullCalendar.gcalFeed('http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic') });

});
</script>

So what I'm doing is instantiating FullCalendar at the start of my script, then further down adding events individually. I'm not completely convinced this is the best method of solving the problem, so if anyone has any other suggestions I'd really like to hear them.

EDIT

So I realised that the original code instantiates FullCalendar for each feed, so in this instance I would have 5 calendars on my page... whoops, I cam across this post of which gave me the answer:

<script type="text/javascript">
$(document).ready(function() {
    $('#calendar').fullCalendar('addEventSource', "/?module=1&controller=3&action=getJSON&id=1")
                  .fullCalendar('addEventSource', "/?module=1&controller=2&action=getJSON&id=2")
                  .fullCalendar('addEventSource', "/?module=1&controller=2&action=getJSON&id=3")
                  .fullCalendar('addEventSource', "/?module=1&controller=2&action=getJSON&id=4")
                  .fullCalendar('addEventSource', "/?module=1&controller=2&action=getJSON&id=5");

});
</script>
ILMV