我对KendoUI Scheduler数据(调度程序事件或任何你想要调用的东西)显示有点困难。调用是在数据进入但是它没有显示它,也不会导致任何错误。我已粘贴代码并做出回应,希望有人知道我做错了什么。
是的,我一直在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"
}
]
答案 0 :(得分:1)
在没有错误的情况下,我遇到了同样的问题。是什么修复了(傻但是)我设置了开始和结束时区,即。 task.setEndTimezone(TimeZone.getTimeZone(“UTC”));,只需将它们设置为null,同时仍在任务的返回的开始和结束日期时间设置时区。希望这会有所帮助。
答案 1 :(得分:0)
使用Firefox调试时,我看到“ReferenceError:convertDate未定义”...
dtFrom:convertDate($(“#calendar”)。data(“kendoScheduler”)。view()。startDate()), dtUntil:convertDate($(“#calendar”)。data(“kendoScheduler”)。view()。endDate()),
您可能希望确保包含所有相应的.js文件