Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FullCalendar and multiple event sources

I have a couple of json feeds that I'd like to display on the calendar.

Looking at the docs there does seem some explanation, but no example of having more than 1 json feed.

I have the following:

var source = Array();
source[0] = '/feed1.php';
source[1] = '/feed2.php';
eventSources: [
  source[0],
  source[1]
]

This displays the events fine and I can seem them on my calendar

But how would I differentiate between them in terms of colors?

Thanks

like image 982
user789122 Avatar asked Dec 25 '22 17:12

user789122


1 Answers

You can use the extended form of event sources to give each source its own color. In the code below, "color" is the event background color and "textColor" is the color of the event text.

$('#calendar').fullCalendar({
  header: {
    left: 'prev,next',
    center: 'title',
    right: 'today'
  },

  eventSources: [
    {
      url: '/feed1.php',
      color: 'yellow',
      textColor: 'black'
    },
    {
      url: '/feed2.php',
      color: 'blue',
      textColor: 'white'
    }
  ]
});

Here's a JSFiddle that uses this method: http://jsfiddle.net/emcw5/4/.

like image 69
Brian Showalter Avatar answered Feb 13 '23 02:02

Brian Showalter