Event Source Object

An “event source” is anything that provides FullCalendar with data about events. It can be a simple array, an event-generating function that you define, a URL to a json feed, or a Google Calendar feed.

Event Objects can have “options” associated with them. However, before you can start specifying options, you must write an Event Object in its extended form. It must be a traditional JavaScript object with properties. Here are the extended forms for each type of Event Source:

Array of events:

{
  events: [
    {
      title: 'Event1',
      start: '2011-04-04'
    },
    {
      title: 'Event2',
      start: '2011-05-05'
    }
    // etc...
  ],
  color: 'yellow',   // an option!
  contrastColor: 'black' // an option!
}

Event-generating function:

{
  events: function(info, successCallback, failureCallback) {
    // ...
  },
  color: 'yellow',   // an option!
  contrastColor: 'black' // an option!
}

JSON feed:

{
  url: '/myfeed.php',
  color: 'yellow',   // an option!
  contrastColor: 'black' // an option!
}

Google Calendar feed:

{
  googleCalendarId: 'abcd1234@group.calendar.google.com',
  color: 'yellow',   // an option!
  contrastColor: 'black' // an option!
}

Event Source Options

idOptional. Useful for getEventSourceById.
url

If a JSON feed or iCalendar feed, the specified URL

format

Specify 'json' for a JSON feed (the default) or 'ics' for an iCalendar feed

colorSets every Event Object's color for this source.
contrastColorSets every Event Object's contrastColor for this source.
classNameSets every Event Object's className for this source.
editableSets every Event Object's editable for this source.
startEditableSets every Event Object's startEditable for this source.
durationEditableSets every Event Object's durationEditable for this source.
resourceEditableSets every Event Object's resourceEditable for this source.
displaySets the eventDisplay setting for every event in this source.
overlapSets the eventOverlap setting for every event in this source. Does not accept a function.
constraintSets the eventConstraint setting for every event in this source.
allowSets the eventAllow setting for every event in this source.
defaultAllDaySets the defaultAllDay option, but only for this source.
success

Sets the eventSourceSuccess callback, but only for this source.

failure

Sets the eventSourceFailure callback, but only for this source.

eventDataTransformSets the eventDataTransform callback, but only for this source.

For JSON feeds, there are additional options you can set.

After Parsing

The above object is what you specify to initially define an event source, but if you want to access it and manipulate it dynamically afterwards, you’ll be dealing with a different type of object. This type of object is emitted from methods like getEventSources and getEventSourceById. It has the following properties and methods:

id

The specified ID

url

If a JSON feed or iCalendar feed, the specified URL

format

'json' for a JSON feed, 'ics' for an iCalendar feed, or null for anything else.

refetch()

Refetches event data for this event source. More information.

remove()

Removes this source from the calendar More information.