我在显示 KendoUI 调度程序数据(调度程序事件或您想调用的任何内容)时遇到了一些困难。调用是在数据进入时进行的,但它不显示它,也不会导致任何错误。我已经粘贴了代码和响应,希望有人知道我做错了什么。
是的,我一直在 json/jsonp 作为数据类型和批处理在所有可能的组合中设置为 true 和 false 之间切换。
编码:
var my_dataSource;
$("#calendar").kendoScheduler({
height: "650px",
timezone: "Etc/UTC",
views: [
"day",
"week",
{ type: "month", selected: true },
"agenda"
]
});
my_dataSource = new kendo.data.SchedulerDataSource({
transport: {
read: {
url: "ashx/Calendar/GetCalendarData.ashx",
cache: false,
data: {
dtFrom: convertDate($("#calendar").data("kendoScheduler").view().startDate()),
dtUntil: convertDate($("#calendar").data("kendoScheduler").view().endDate()),
DateInterval: "month",
dateIntervalSteps: "1",
Categories: ""
},
dataType: "jsonp"
},
batch: true,
parameterMap: function (options, operation) {
//console.log(JSON.stringify(options));
return options;
}
},
schema: {
data: "Data",
model: {
id: "taskID",
fields: {
taskID: { from: "id", type: "number" },
title: { from: "summary", defaultValue: "No title", validation: { required: false } },
start: { type: "date", from: "startTime" },
end: { type: "date", from: "endTime" },
//startTimezone: { from: "StartTimezone" },
//endTimezone: { from: "EndTimezone" },
//description: { from: "Description" },
//recurrenceId: { from: "RecurrenceID" },
//recurrenceRule: { from: "RecurrenceRule" },
//recurrenceException: { from: "RecurrenceException" },
ownerId: { from: "eOwnerId", defaultValue: 1 },
isAllDay: { type: "boolean", from: "allDay" }
}
}
}
});
var cal = $("#calendar").data("kendoScheduler");
cal.dataSource = my_dataSource;
响应:
[
{
"id": 329837,
"summary": "Lorem Ipsum",
"startTime": "Date(1375862400)",
"endTime": "Date(1377273600)",
"allDay": true,
"calendar": "cat10001",
"eOwnerId": 1569,
"Title": "Project Meeting"
},
{
"id": 334664,
"summary": "Lorem Ipsum",
"startTime": "Date(1376985600)",
"endTime": "Date(1376989200)",
"allDay": false,
"calendar": "cat10002",
"eOwnerId": 130,
"Title": "Meeting"
},
{
"id": 334659,
"summary": "Lorem Ipsum",
"startTime": "Date(1377007200)",
"endTime": "Date(1377010800)",
"allDay": false,
"calendar": "cat10003",
"eOwnerId": 1810,
"Title": "Task"
}
]