简体   繁体   English

从AlloyUI Scheduler获取事件

[英]Get events from AlloyUI Scheduler

Im trying to get the events from the Scheduler but cant seem to do so. 我试图从调度程序中获取事件,但似乎无法这样做。 By looking at their documentation I found that I needed to implement SchedulerEventSupport. 通过查看他们的文档,我发现我需要实现SchedulerEventSupport。 I implemented it like this: 我是这样实现的:

        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());
        }

Everytime I run displayEvents() I get this error TypeError: Cannot read property 'sort' of undefined . 每次运行displayEvents()时,都会发生此错误TypeError: Cannot read property 'sort' of undefined

How Can I display the events saved in scheduler? 如何显示计划程序中保存的事件?

Use Scheduler.getEvents() : 使用Scheduler.getEvents()

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM