【问题标题】:How to Add and Edit Events through Generic handler in Kendo UI Scheduler?如何通过 Kendo UI Scheduler 中的通用处理程序添加和编辑事件?
【发布时间】:2014-04-02 08:01:59
【问题描述】:

我想通过通用处理程序将 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" },

            }
        }
    }
}

【问题讨论】:

    标签: c# jquery kendo-ui kendo-scheduler


    【解决方案1】:

    这些方法是您要更改的并指向 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、标题、开始、结束

    Kendo UI 调度程序代码将尝试将 JSON 数据发布到这些 Url,具体取决于您尝试执行的操作。如果您使用的是 Firebug(在 Firefox 中)或 Fiddler2,您可以检查发布的数据以及使用您的 IDE(如 Visual Studio、Eclipse 等)来单步执行接收服务器端代码。

    我一直在研究这个调度程序(尽管来自 ASP.NET MVC 包装器版本),这是我的主要帖子:Binding a DropDownList in Kendo Scheduler Custom Template (ASP.NET MVC Wrapper version) 我在试图找出调度程序时分解了一些更多信息,例如你在做。其中一些可能很有用,例如构建服务器端代码以接收数据。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-07-16
      • 2014-06-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-08
      • 2014-04-24
      • 1970-01-01
      相关资源
      最近更新 更多