【问题标题】:Kendo UI Scheduler destroy recurring eventKendo UI Scheduler 销毁重复事件
【发布时间】: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 }
                            }
                        }
                    }
                }
            });
        }

【问题讨论】:

    标签: kendo-ui kendo-scheduler


    【解决方案1】:

    问题已解决。
    刚刚将模型更改为:

    型号:{ id: "apptID", 字段:{ apptID:{来自:“ApptID”,类型:“字符串”}, entryID: { from: "EntryID", type: "string" }, 开始:{从:“开始”,输入:“日期”}, 结束:{来自:“结束”,输入:“日期”}, 开始时区:{来自:“开始时区”}, endTimezone:{来自:“EndTimezone”}, 标题:{来自:“主题”}, 标题事件:{来自:“标题事件”}, 位置:{来自:“位置”}, 描述:{来自:“描述”}, 复发ID:{来自:“RecurrenceID”,类型:“字符串”}, 复发规则:{来自:“RecurrenceRule”}, 复发异常:{来自:“RecurrenceException”}, ownerId: { from: "OwnerID", defaultValue: 1 }, isAllDay: { type: "boolean", from: "IsAllDay" }, useTz:{类型:“布尔”,来自:“UseTimezones”}, 历史:{来自:“历史”}, 类别:{来自:“类别”,可为空:真} } }

    【讨论】:

    • OP 更改了 model id 值、fields id/apptIDrecurrenceId 值。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-07-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-25
    相关资源
    最近更新 更多