These docs are for an old release. Info on upgrading to v6

resources (as a function)

A custom function for programmatically generating raw Resources objects. This allows for any sort of asynchronous means of obtaining the resource list.

function( fetchInfo, successCallback, failureCallback ) { }

The function is given a successCallback argument that should be called with an array of raw Resource objects:

var calendar = new Calendar(calendarEl, {

  resources: function(fetchInfo, successCallback, failureCallback) {
    somethingAsynchonous(function(resources) {
      successCallback(resources);
    });
  }

});

If there is some sort of failure, for example, if an AJAX request should fail, then call the failureCallback instead. It accepts an argument with information about the failure.

Instead of calling successCallback and failureCallback, you may return a Promise-like object instead.

Fetching based on current date

If refetchResourcesOnNavigate is set to true, the resources function’s fetchInfo argument will be populated with some useful arguments. It will receive the start and end dates for the newly visible window of time as well as the calendar’s timezone:

var calendar = new Calendar(calendarEl, {

  refetchResourcesOnNavigate: true,

  resources: function(fetchInfo, successCallback, failureCallback) {
    somethingAsynchonous({
      start: fetchInfo.start,
      end: fetchInfo.end,
      timeZone: fetchInfo.timeZone
    }, function(resources) {
      successCallback(resources);
    });
  }

});

Complete list of properties in fetchInfo:

start

A Date for the beginning of the range the calendar needs events for.

end

A Date for the end of the range the calendar needs events for.

Note: This value is exclusive. For example, an event with the end of 2018-09-03 will appear to span through 2018-09-02, but end before the start of 2018-09-03. See how events are are parsed from a plain object for further details.

startStr

An ISO8601 string representation of the start date. Will have a time zone offset according to the calendar’s timeZone like 2018-09-01T12:30:00-05:00.

endStr

Just like startStr, but for the end date.

timeZone

The exact value of the calendar’s timeZone setting.