我是Alloyui的新人。我目前正在使用alloyui来定义一个简单的调度程序视图。当我阅读Alloyui的api doc时,我对如何使用函数getUpdatedSchedulerEvent感到非常困惑。我在google上搜索过它,但是很难找到这些例子,而且文档也不能直接解释。
有人可以向我提供一些详细的解释或简单的例子吗?
非常感谢。
我使用的定义调度程序的代码如下:
var schedulerViews = [
new Y.SchedulerWeekView(),
new Y.SchedulerDayView(),
new Y.SchedulerMonthView()
];
var eventRecord = new Y.SchedulerEventRecorder({
on: {
save: function (event) {
var start_time = this.getClearStartDate();
var end_time = this.getClearEndDate();
var facility_name = "{{ item.facility.facility_name }}";
$.ajax({
url: "/TT/#tab-{{item.facility.facility_name}}",
type: 'post',
data: {json_data: JSON.stringify({start_time: start_time, end_time: end_time, facility_name: facility_name})},
success: function (response) {
},
complete: function () {
},
error: function (xhr, textStatus, thrownError) {
alert("error doing something");
}
});
{# alert('Save Event:' + this.isNew() + ' --- ' + this.getContentNode().val());#}
alert('Save Event:' + this.isNew() + ' --- ' + this.getClearStartDate());
},
edit: function (event) {
alert('Edit Event:' + this.isNew() + ' --- ' + this.getContentNode().val());
},
delete: function (event) {
alert('Delete Event:' + this.isNew() + ' --- ' + this.getContentNode().val());
}
}
});
new Y.Scheduler({
boundingBox: '#myScheduler-{{item.facility.facility_name}}',
items: events,
render: true,
views: schedulerViews,
activeView: schedulerViews[0],
eventRecorder: eventRecord
});
答案 0 :(得分:0)
我很幸运能做到以下几点:
data: { "content": this.getContentNode().val(), "startDate": new Date( this.get('startDate') ).getTime() / 1000 - 18000, "endDate": new Date( this.get('endDate') ).getTime() / 1000 -18000 },