How can I listen for the Save, Edit, Delete, and Cancel events from AlloyUI's Scheduler? I need to save the value in our database for future use, but I don't see any documentation for this.
The current code that I have is this:
YUI().use('aui-scheduler', function(Y) {
var items = [
{
content: 'Wake Early'
},
{
content: 'Exercise'
},
];
var schedulerViews = [
new Y.SchedulerWeekView(),
new Y.SchedulerDayView(),
new Y.SchedulerMonthView(),
new Y.SchedulerAgendaView()
];
var eventRecorder = new Y.SchedulerEventRecorder();
new Y.Scheduler({
boundingBox: '#scheduler',
items: items,
views: schedulerViews,
activeView: schedulerViews[2],
eventRecorder: eventRecorder,
firstDayOfWeek: 1,
// activeView: weekView,
// views: [dayView, weekView, monthView, agendaView]
}).render();
Y.Do.after(function() {
this.on("save",function(data){
alert('Event:'+this.isNew()+' --- '+this.getContentNode().val());
});
}, eventRecorder, 'showPopover');
});
I'm having no luck so far, can anyone help me out? I've tried this tutorial and this one as well but they haven't helped.
You should use the undocumented
save
,edit
,delete
, andcancel
* events ofSchedulerEventRecorder
. For example:Here's a runnable example with the code you provided:
*The
cancel
event seems be a bit buggy and occurs at the wrong times, so I commented it out. It seems to occur whenever any other event occurs.