在Alloy UI Scheduler上保存和编辑后,如何将endDate,startDate和时间保存到我的数据库中?
目前,我只能保存"内容"
这是我的代码。
var eventRecorder = new Y.SchedulerEventRecorder({
on: {
save: function (event) {
alert('Save Event:' + this.isNew() + ' --- ' + this.getContentNode().val());
},
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());
}
}
});

答案 0 :(得分:0)
样品就在这里:
save: function(event) {
alert('Save Event:' + this.isNew() + ' --- ' + this.getContentNode().val() + ' startdate : '+this.get('startDate') + ' enddate : '+this.get('endDate') );
},
答案 1 :(得分:0)
您可以通过获取startDate
的endDate
和SchedulerEventRecorder
属性来保存开始和结束时间:
var eventRecorder = new Y.SchedulerEventRecorder({
on: {
save: function(event) {
console.log(
'startDate: ' + eventRecorder.get('startDate') +
'\nendDate: ' + eventRecorder.get('endDate')
);
}
}
});
这是一个可运行的例子:
YUI().use('aui-scheduler', function(Y) {
var eventRecorder = new Y.SchedulerEventRecorder({
on: {
save: function(event) {
alert(
'startDate: ' + eventRecorder.get('startDate') +
'\nendDate: ' + eventRecorder.get('endDate')
);
}
}
});
var weekView = new Y.SchedulerWeekView();
new Y.Scheduler({
boundingBox: '#myScheduler',
date: new Date(2013, 1, 4),
eventRecorder: eventRecorder,
render: true,
views: [weekView]
});
});

<script src="https://cdn.rawgit.com/stiemannkj1/701826667a70997013605edcd37e92a6/raw/469fe1ae297e72a5a80eb9015003b7b04eac735e/alloy-ui-3.0.1_aui_aui-min.js"></script>
<link href="https://cdn.rawgit.com/stiemannkj1/90be22de7f48c729b443af14796d91d3/raw/a9f35ceedfac7fc0559b121bed105eaf80f10bf2/aui-css_css_bootstrap.min.css" rel="stylesheet"></link>
<div id="wrapper" class="yui3-skin-sam">
<div id="myScheduler"></div>
</div>
&#13;