我正在尝试实施Kendo UI scheduler
. 但我似乎无法开始datasource
工作。
我的 JS 是:
var diary = {
open: function() {
dialog('diary', function() {
$('#diaryDialog').css('width', '1450px');
$('#calendar').kendoScheduler({
date: new Date("2013/6/13"),
startTime: new Date("2013/6/13 07:00 AM"),
height: 700,
views: [
"day",
{type: "workWeek", selected: true},
"week",
"month",
"agenda"
],
timezone: "Etc/UTC",
dataSource: {
batch: true,
transport: {
read: {
url: ROOT + "Diary/fetchDiary",
type: "POST",
dataType: "json"
},
update: {
url: "http://demos.telerik.com/kendo-ui/service/tasks/update",
dataType: "json"
},
create: {
url: "http://demos.telerik.com/kendo-ui/service/tasks/create",
dataType: "json"
},
destroy: {
url: "http://demos.telerik.com/kendo-ui/service/tasks/destroy",
dataType: "json"
},
parameterMap: function(options, operation) {
if (operation !== "read" && options.models) {
return kendo.stringify(options.models);
}
}
},
schema: {
model: {
id: "taskId",
fields: {
taskId: {from: "TaskID", type: "number"},
title: {from: "Title", defaultValue: "No title", validation: {required: true}},
start: {type: "date", from: "Start"},
end: {type: "date", from: "End"},
startTimezone: {from: "StartTimezone"},
endTimezone: {from: "EndTimezone"},
description: {from: "Description"},
recurrenceId: {from: "RecurrenceID"},
recurrenceRule: {from: "RecurrenceRule"},
recurrenceException: {from: "RecurrenceException"},
ownerId: {from: "OwnerID", defaultValue: 1},
isAllDay: {type: "boolean", from: "IsAllDay"}
}
}
},
filter: {
logic: "or",
filters: [
{field: "ownerId", operator: "eq", value: 1},
{field: "ownerId", operator: "eq", value: 2}
]
}
},
})
})
}
}
而它初始化过来的数据字符串的时间是:
[{"TaskID":4,
"OwnerID":2,
"Title":"Bowling tournament",
"Description":"",
"StartTimezone":null,
"Start":"Date(1370811600000)",
"End":"Date(1370822400000)",
"EndTimezone":null,
"RecurrenceRule":null,
"RecurrenceID":null,
"RecurrenceException":null,
"IsAllDay":false}]
但它不起作用,我在控制台中收到错误:
Uncaught TypeError: Cannot read property 'getTimezoneOffset' of null
我的PHP:
public function fetchDiary() {
echo '[{
"TaskID":4,
"OwnerID":2,
"Title":"Bowling tournament",
"Description":"",
"StartTimezone":null,
"Start":"Date(1370811600000)",
"End":"Date(1370822400000)",
"EndTimezone":null,
"RecurrenceRule":null,
"RecurrenceID":null,
"RecurrenceException":null,
"IsAllDay":false}]';
}