如何通过 Kendo UI 计划程序中的泛型处理程序添加和编辑事件

本文关键字:程序 处理 添加 事件 编辑 泛型 Kendo 何通过 UI 计划 | 更新日期: 2023-09-27 17:56:11

我想通过通用处理程序将 Kendo UI 调度程序中的事件添加到数据库中 我该怎么做? 以及如何获取事件字段并将它们传递给处理程序?我已经通过以下代码成功填充了调度程序中的事件,但我无法弄清楚如何添加新事件并更新或删除它们......

dataSource: {
    transport:
    {
        read:
        {
            url: "../Handler.ashx",
            dataType: "json",
            //contentType: "application/json; charset=utf-8",
        },
        update: {
            url: "http://demos.telerik.com/kendo-ui/service/meetings/update",
            dataType: "jsonp"
        },
        create: {
            url: "http://demos.telerik.com/kendo-ui/service/meetings/create",
            dataType: "jsonp"
        },
        destroy: {
            url: "http://demos.telerik.com/kendo-ui/service/meetings/destroy",
            dataType: "jsonp"
        },
        parameterMap: function (options, operation) {
            if (operation !== "read" && options.models) {
                return { models: kendo.stringify(options.models) };
            }
        }
    }, schema: {
        model: {
            id: "id",
            fields: {
                id: { from: "id", type: "number" },
                title: { field: "title", defaultValue: "No title", validation: { required: true } },
                start: { type: "date", field: "start" },
                end: { type: "date", field: "end" },
            }
        }
    }
}

如何通过 Kendo UI 计划程序中的泛型处理程序添加和编辑事件

这些方法是您要更改并指向 ASHX 文件或 MVC 方法(当然,如果使用 MVC):

网络表单

update: {
        url: "http://localhost:30000/update.ashx",
        dataType: "jsonp"
    },
create: {
        url: "http://localhost:30000/create.ashx",
        dataType: "jsonp"
    },
destroy: {
        url: "http://localhost:30000/destroy.ashx",
        dataType: "jsonp"
    },

MVC

update: {
        url: "http://localhost:30000/home/update",
        dataType: "jsonp"
    },
create: {
        url: "http://localhost:30000/home/create",
        dataType: "jsonp"
    },
destroy: {
        url: "http://localhost:30000/home/destroy",
        dataType: "jsonp"
    },

从您的示例中,看起来遇到的事件字段是:

id, title, start, end

剑道 UI 计划程序代码将尝试将 JSON 数据发布到这些 URL,具体取决于您尝试执行的操作。 如果您使用的是Firebug(在Firefox中)或Fiddler2,则可以检查正在发布的数据以及使用IDE(如Visual Studio,Eclipse等)逐步执行接收服务器端代码。

我已经了解了这个调度程序(虽然来自 ASP.NET MVC包装器版本),这是我的主要文章:在Kendo Scheduler自定义模板中绑定DropDownList(ASP.NET MVC包装器版本) 在试图像您一样找出调度程序时,我分解了更多信息。其中一些可能很有用,例如构造服务器端代码以接收数据。

下面是 MVC 中的一个示例:http://www.telerik.com/support/code-library/custom-editor-9fd60fca3c02