我正在使用Kendo UI Scheduler。
我有一个反复出现的事件,有几个例外。
当我尝试删除整个系列的重复事件时,然后在parameterMap函数options.model中只包含重复事件而没有异常。
删除后,这些异常仍存在于调度程序中,因此我需要重新读取数据源。
我检查了kendo ui demo scheduler,在他们的示例中,options.model包含重复事件和此事件的所有异常,并从调度程序中删除重复事件和所有异常。
异常具有重复发生的重复事件 我也想进入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 }
}
}
}
}
});
}
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 }
}
}
}
}
});
}
答案 0 :(得分:0)
问题已解决
刚改变模型:
model: {
id: "apptID",
fields: {
apptID: { from: "ApptID", type: "string" },
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", type: "string" },
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 }
}
}