gpt4 book ai didi

javascript - fullcalendar.io 在一个 feed 中包含多个事件源

转载 作者:行者123 更新时间:2023-12-03 03:11:35 26 4
gpt4 key购买 nike

在 fullcalendar 中可以定义多个 feed

    $('#calendar').fullCalendar({

eventSources: [
// your event source
{
url: '/myfeed1',
color: 'yellow'
},
{
url: '/myfeed2',
color: 'red'
}
]
});

是否可以在一个 json feed 中定义多个源?

我的目标是这样的:

 $('#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,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
}

});

您不得传递 colortextColor 选项,并在后端聚合多个 Fe​​ed。后端的结果应与此类似:

[
{
title: 'event1',
start: '2010-01-01',
color: 'yellow',
},
{
title: 'event1',
start: '2010-01-01',
color: 'red',
}
]

关于javascript - fullcalendar.io 在一个 feed 中包含多个事件源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46928625/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com