我已经阅读了几个小时的完整日历文档,并查看了提供的演示,但我不知道这是否可能。
我目前正在从谷歌日历中获取事件,其中包含一系列字段,例如:
{
"status": "confirmed",
"kind": "calendar#event",
"end": {
"dateTime": "2015-06-29T17: 00: 00+02: 00"
},
"created": "2015-06-27T15: 29: 09.000Z",
"iCalUID": "grmb2ff27hh4ppvk0o7lfclimc@google.com",
"reminders": {
"useDefault": "True"
},
"htmlLink": "https: //www.google.com/calendar/event?eid=Z3JtYjJmZjI3aGg0cHB2azBvN2xmY2xpbWMgZGV2LmFsZWphbmRyb3ZpbGxhbWFyaW5AbQ",
"sequence": 0,
"updated": "2015-06-27T15: 29: 11.144Z",
"summary": "flowerpower",
"start": {
"dateTime": "2015-06-29T14: 00: 00+02: 00"
},
"etag": "2870837902288000",
"organizer": {
"self": "True",
"displayName": "AlejandroVillamarin",
"email": "dev.alejandrovillamarin@gmail.com"
},
"creator": {
"self": "True",
"displayName": "AlejandroVillamarin",
"email": "dev.alejandrovillamarin@gmail.com"
},
"id": "grmb2ff27hh4ppvk0o7lfclimc"
}
虽然我想保留这些数据,甚至通过ajax调用将其发送到fullcalendar,但我只想在日历中显示其中的"一些"字段。。。我该怎么做?我总是可以使用2个数组,但奇怪的是,除了壮观的fullcalendar库之外,另一个库没有提供自定义每个日历事件中显示的字段的方法。
谢谢,Alejandro
我一直将FullCalendar eventRender事件与jQuery结合使用来控制这些事情。
下面是我最近的一个项目的例子:
$(targetElement).fullCalendar({
events: function (start, end, callback) {
// code to grab events
},
eventRender: function (event, element) {
// 'event' will have all the fields that you want
// add css class 'label' and display status of event
element.find('.fc-event-title').addClass('label').append('STATUS ' + event.status);
var view = $(targetElement).fullCalendar('getView');
if (view.name === "agendaDay") {
// day view specific stuff here
}
if (view.name === "agendaWeek") {
// week view specific stuff here
}
}
});
我将这种数据的附加与事件的title属性结合使用。