In fullcalendar it is possible to define multiple feeds
$('#calendar').fullCalendar({
eventSources: [
// your event source
{
url: '/myfeed1',
color: 'yellow'
},
{
url: '/myfeed2',
color: 'red'
}
]
});
Is it possible to define multiple sources in one json feed?
I'm aiming for something like this:
$('#calendar').fullCalendar({
eventSources: '/multiplefeedsineone'
});
"Multiplefeedsinone" would return:
{
events: [
{
title: 'EventFromFeed1_1',
start: '2011-04-04'
},
{
title: 'EventFromFeed1_2',
start: '2011-05-05'
}
],
color: 'yellow'
},
{
events: [
{
title: 'EventFromFeed2_1',
start: '2011-04-04'
},
{
title: 'EventFromFeed2_2',
start: '2011-05-05'
}
],
color: 'red'
}
If using a single source URL, an events
object is passed instead of an eventSources
object.
$('#calendar').fullCalendar({
events: {
url: '/myfeed.php',
type: 'POST',
data: {
custom_param1: 'something',
custom_param2: 'somethingelse'
},
error: function() {
alert('there was an error while fetching events!');
},
color: 'yellow', // a non-ajax option
textColor: 'black' // a non-ajax option
}
});
You may not pass color
and textColor
options and in your backend aggregate multiple feeds. Results from your backend should be similar to this:
[
{
title: 'event1',
start: '2010-01-01',
color: 'yellow',
},
{
title: 'event1',
start: '2010-01-01',
color: 'red',
}
]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.