我试图从调度程序中获取事件,但似乎无法这样做。通过查看他们的文档,我发现我需要实现SchedulerEventSupport。我这样实现了它:
var agendaView = new Y.SchedulerAgendaView();
var dayView = new Y.SchedulerDayView();
var eventRecorder = new Y.SchedulerEventRecorder();
//global variable
eventSupport = new Y.SchedulerEventSupport();
var monthView = new Y.SchedulerMonthView();
var weekView = new Y.SchedulerWeekView();
schedule = new Y.Scheduler(
{
activeView: weekView,
boundingBox: '#myScheduler',
date: new Date(2013, 1, 4),
eventRecorder: eventRecorder,
items: events,
render: true,
eventSupport: eventSupport,
views: [dayView, weekView, monthView, agendaView]
}
);
function displayEvents(){
console.log(eventSupport.getEvents());
}
每次我运行displayEvents()时都会收到此错误TypeError: Cannot read property 'sort' of undefined
。
如何显示调度程序中保存的事件?
答案 0 :(得分:0)
function displayEvents(){
console.log(schedule.getEvents());
}