想知道我是如何创建一个对象并用信息填充他的,这样我就可以将他添加到完整的日历 jquery 插件中。到目前为止,我做了类似的事情:
var eventsArray = [];
var newEvent = new Object();
newEvent[title] = "some text";
newEvent[start] = d1; //got date string here exactly similar to the calendar's
eventsArray.push(newEvent);
var formattedEventData = [] ;
for (var k = 0; k < eventsArray.length; k ++) {
formattedEventData.push({
title: eventsArray[k][0],
start: eventsArray[k][1]
});
}
$('#calendar').fullCalendar({
eventsource: formattedEventData,
events: formattedEventData,
color: 'yellow',
textColor: 'black'
});
$('#calendar').fullCalendar('addEventSource',formattedEventData);
$('#calendar').fullCalendar('rerenderEvents');
我忘了说......一切都很好,没有崩溃......但日历中没有什么新鲜事。谢谢!