我查看了其他帖子,我看到了如何从SchedulerEventRecorder中编辑,更改和删除事件。我无法找到的一件事是如何听取拖动事件?我似乎无法找到任何关于此的文档。以下是我的代码:
YUI().use(
'aui-scheduler',
function(Y) {
var events = [
{
color: '#8B0000',
repeated: true,
content: 'Event1',
endDate: new Date(2017, 12, 1, 16),
startDate: new Date(2017, 12, 1, 1)
}
];
var agendaView = new Y.SchedulerAgendaView();
var dayView = new Y.SchedulerDayView();
var monthView = new Y.SchedulerMonthView();
var weekView = new Y.SchedulerWeekView();
var eventRecorder = new Y.SchedulerEventRecorder({
on: {
save: function(event) {
alert('Save Event:' + this.isNew() + ' --- ' + this.getContentNode().val()+'-----startDate='+this.get('startDate')+'-----EndDate='+this.get('endDate'));
},
edit: function(event) {
alert('Edit Event:' + this.isNew() + ' --- ' + this.getContentNode().val());
},
delete: function(event) {
alert('Delete Event:' + this.isNew() + ' --- ' + this.getContentNode().val());
// Note: The cancel event seems to be buggy and occurs at the wrong times, so I commented it out.
// },
// cancel: function(event) {
// alert('Cancel Event:' + this.isNew() + ' --- ' + this.getContentNode().val());
}
}
});
schedule =new Y.Scheduler(
{
activeView: weekView,
boundingBox: '#myScheduler',
date: new Date(2017, 12, 1),
eventRecorder: eventRecorder,
items: events,
render: true,
views: [dayView, weekView, monthView, agendaView]
}
);
}
);
答案 0 :(得分:0)
收听保存回调中的任何更改,如下所示:
event.newSchedulerEvent.on("endDateChange",function(event){
});
在这种情况下,我正在听endDate。
答案 1 :(得分:0)
在初始化Scheduler时添加“ drag:end”属性
new Y.Scheduler({
activeView: ...,
boundingBox: '#myScheduler',
eventRecorder: ...,
render: true,
views: [dayView, weekView, monthView, agendaView],
on: {
"drag:end": function (event) {
// DO SOMETHING HERE
}
}
});