[英]fullcalendar.io multiple eventsources in one feed
全日歷中可以定義多個提要
$('#calendar').fullCalendar({
eventSources: [
// your event source
{
url: '/myfeed1',
color: 'yellow'
},
{
url: '/myfeed2',
color: 'red'
}
]
});
是否可以在一個json提要中定義多個源?
我的目標是這樣的:
$('#calendar').fullCalendar({
eventSources: '/multiplefeedsineone'
});
“ Multiplefeedsinone”將返回:
{
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'
}
如果使用單個源URL, 則傳遞events
對象而不是eventSources
對象。
$('#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
}
});
您可能無法傳遞color
和textColor
選項,並且在后端聚合了多個feed。 后端的結果應與此類似:
[
{
title: 'event1',
start: '2010-01-01',
color: 'yellow',
},
{
title: 'event1',
start: '2010-01-01',
color: 'red',
}
]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.