fullcalendar赢得';t使用eventSource显示json提要
我第一次使用fullcalendar。开始看起来很简单,但后来出现了问题。好的,我正在尝试使用eventSource加载多个源。它加载所有google日历源没有问题,但是json提要没有显示。我想知道这是因为我使用了一个静态json文件来测试,还是我遗漏了什么,或者json格式是错误的。我是否需要用java编写json提要来测试(使用java)?这些都是我看过的内容,我看过关于fullcalendar和json的其他链接,但都没有帮助。如果有人能给我一点帮助,我将不胜感激 feed.jsonfullcalendar赢得';t使用eventSource显示json提要,json,fullcalendar,Json,Fullcalendar,我第一次使用fullcalendar。开始看起来很简单,但后来出现了问题。好的,我正在尝试使用eventSource加载多个源。它加载所有google日历源没有问题,但是json提要没有显示。我想知道这是因为我使用了一个静态json文件来测试,还是我遗漏了什么,或者json格式是错误的。我是否需要用java编写json提要来测试(使用java)?这些都是我看过的内容,我看过关于fullcalendar和json的其他链接,但都没有帮助。如果有人能给我一点帮助,我将不胜感激 feed.json {
{
"events":
[
{
"id": "0",
"title": "Business Lunch",
"start": "2015-09-03T13:00:00",
"end": "2015-09-03T14:00:00",
"constraint": "businessHours"
},
{
"id": "2",
"title": "Conference",
"start": "2015-09-18",
"end": "2015-09-19",
"constraint": "businessHours"
},
{
"id": "3",
"title": "Party",
"start": "2015-09-29T20:00:00",
"end": "2015-09-29T24:00:00",
"constraint": "businessHours"
}
]
}
代码示例
eventSources: [
// your event source
//feed source
{
url: '/hairzone/feed.json',
type: 'GET', //GET or POST
dataType: 'json',
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
},
// any other sources...
{
googleCalendarId: 'some calendar id',
color: 'pink', // an option!
textColor: 'black', // an option!
//rendering: 'background'
overlay:false
},
// any other sources...
{
googleCalendarId: 'some calendar id',
color: 'blue', // an option!
textColor: 'black', // an option!
rendering: 'background',
overlay:false
}
]
我解决了这个问题。对于fullcalendar,提要的格式似乎不正确。它只需要从括号开始的所有内容。不管是静态文件还是生成的提要
[
{
"id": "0",
"title": "Business Lunch",
"start": "2015-09-03T13:00:00",
"end": "2015-09-03T14:00:00",
"constraint": "businessHours"
},
{
"id": "2",
"title": "Conference",
"start": "2015-09-18",
"end": "2015-09-19",
"constraint": "businessHours"
},
{
"id": "3",
"title": "Party",
"start": "2015-09-29T20:00:00",
"end": "2015-09-29T24:00:00",
"constraint": "businessHours"
}
]
这一联系起了作用。