从 AlloyUI Scheduler 获取事件

Get events from AlloyUI Scheduler

我正在尝试从调度程序获取事件,但似乎做不到。通过查看他们的文档,我发现我需要实施 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

如何显示保存在调度程序中的事件?

使用Scheduler.getEvents():

function displayEvents(){
    console.log(schedule.getEvents());
}