Kendo UI Scheduler Datasource
I am trying to implement Kendo UI scheduler
. But I can't get it to datasource
work.
My 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}
]
}
},
})
})
}
}
And when it initializes the data string that comes in is:
[{"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}]
But it doesn't work and I get an error in the console:
Uncaught TypeError: Cannot read property 'getTimezoneOffset' of null
My 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}]';
}
+3
source to share
No one has answered this question yet
Check out similar questions: