【发布时间】:2015-05-20 16:09:05
【问题描述】:
我正在使用 Kendo UI 调度程序。
我有一个经常发生的事件,但有几个例外。
当我尝试删除整个系列的重复事件时,在 parameterMap 函数 options.model 中只包含重复事件,没有例外。
删除后这些异常仍然存在于调度程序中,所以我需要重新读取数据源。
我检查了kendo ui demo scheduler,在他们的示例中,options.model 包含重复事件和该事件的所有异常,并从调度程序中删除重复事件和所有异常。
异常具有重复事件的recurrenceId。
我也想加入 options.model 异常。
这是我的代码:
function InitScheduler() {
$("#Scheduler").kendoScheduler({
name: "Scheduler",
date: GetSelectDate(),
timezone: GetTimeZone(),
views: [
{ type: "day", selected: isActiveView("day") },
{ type: "workWeek", selected: isActiveView("workWeek") },
{ type: "week", selected: isActiveView("week") },
{ type: "month", selected: isActiveView("month") }
],
dataSource: {
batch: true,
transport: {
read: {
url: "~/Calendar/SchedulerReader",
type: "POST",
dataType: "json"
},
create: {
url: "~/Calendar/SchedulerEditor",
type: "POST",
dataType: "json"
},
update: {
url: "~/Calendar/SchedulerEditor",
type: "POST",
dataType: "json"
},
destroy: {
url: "~/Calendar/SchedulerRemover",
type: "POST",
dataType: "json"
},
parameterMap: function(options, operation) {
//here when operation == 'destroy' options.models contains only one event without exception
if (operation !== "read" && options.models) {
return {models: kendo.stringify(options.models)};
}
}
},
serverFiltering: true,
schema: {
data: function (response) {
return response.Data;
},
model: {
id: "id",
fields: {
id: {from: "ApptID" },
entryID: { from: "EntryID", type: "string" },
start: { from: "Start", type: "date" },
end: { from: "End", type: "date" },
startTimezone: { from: "StartTimezone" },
endTimezone: { from: "EndTimezone" },
title: { from: "Subject" },
titleEvent: { from: "TitleEvent" },
location: { from: "Location" },
description: { from: "Description" },
recurrenceId: { from: "RecurrenceID" },
recurrenceRule: { from: "RecurrenceRule" },
recurrenceException: { from: "RecurrenceException" },
ownerId: { from: "OwnerID", defaultValue: 1 },
isAllDay: { type: "boolean", from: "IsAllDay" },
useTz: { type: "boolean", from: "UseTimezones" },
history: { from: "History" },
categories: { from: "Categories", nullable: true }
}
}
}
}
});
}
【问题讨论】: