c# - Kendo UI 网格中的内联编辑?

标签 c# jquery sharepoint-2010 kendo-ui

在 ajax 调用服务器后,取消按钮仍然存在,并且更新按钮永远不会变回在 Kendo UI 网格中编辑?!我想我必须通知网格更新已完成,但如何通知网格?

<div id="mykendoGrid">
    <script>

        $(document).ready(function () {
            var MydataSource = new kendo.data.DataSource({
                transport: {
                    read: function (options) {
                        $.ajax({
                            url: "/_layouts/AjaxCallHandler/Handler.ashx",
                            contentType: "application/json; charset=utf-8",
                            dataType: "json",
                            cache: false,
                            //data: options.data,
                            success: function (data) {
                                //ko.mapping.fromJS(data, self.seats);
                                options.success(data);
                            }
                        });
                    },
                    update:  function (options) {
                            $.ajax(
                                {
                                    type: 'POST',
                                    url: "/_layouts/AjaxCallHandler/Handler.ashx",
                                    data: { 'currency': ko.mapping.toJSON(options.data) },
                                    success: function (response)
                                    {
                                        // do nothing
                                        alert("Successfully Saved.");
                                    },
                                    error: function (repsonse) {
                                        alert("Manage: UpdateReportName -> Ajax Error!");
                                    }
                                });
                            return;
                        }
                    //parameterMap: function (data, operation) {
                    //    if (operation !== "read") {
                    //        return JSON.stringify({ currency: data })
                    //        //return ko.mapping.fromJS(data, self.seats);
                    //    }
                    //}
                },
                batch: false,
                pageSize: 10,
                schema: {
                    //data: 'd',
                    model:
                    {
                        id: "ID",
                        fields:
                        {
                            ID: { editable: false, nullable: false },
                            DisplayName: { editable: true },
                            Code: { editable: true }
                        }
                    }
                }
            })

            $("#mykendoGrid").kendoGrid({
                dataSource: MydataSource,
                pageable: true,
                toolbar: ["create"],
                columns: [{ field: "ID", title: "ID" }, { field: "DisplayName", title: "Display Name" }, { field: "Code", title: "Code" }, { command: ["edit"], title: "&nbsp;", width: "250px" }],
                editable: "inline",
                scrollable: true
            });
        });

    </script>
</div>

最佳答案

你需要调用options.success();

update:  function (options) {
                        $.ajax(
                            {
                                type: 'POST',
                                url: "/_layouts/AjaxCallHandler/Handler.ashx",
                                data: { 'currency': ko.mapping.toJSON(options.data) },
                                success: function (response)
                                {
                                    // do nothing
                                    alert("Successfully Saved.");
                                    options.success();
                                    //or
                                    //options.success(reponse);
                                },
                                error: function (response) {
                                    alert("Manage: UpdateReportName -> Ajax Error!");
                                    options.error();
                                    //or
                                    //options.error(reponse);
                                }
                            });
                        return;
                    }

关于c# - Kendo UI 网格中的内联编辑?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14579862/

相关文章:

javascript - CSS - 使用 :nth-child to select an element

javascript - 如何使用 jquery/javascript 启用其他表行的 Onclick 事件

javascript - 如何在 wp7 中进行基于声明的身份验证?

c# - 在 UserControl C# .NET 中添加/停靠控件

c# - Reflection.Emit.ILGenerator异常处理 "Leave"指令

c# - foreach 的分支覆盖?

entity-framework - Sharepoint 托管的 CRUD 应用程序? ( Entity Framework ?)

c# - 我应该将 EF 中的实体视为域模型还是 DTO?

javascript - 乘法计算器

c# - "Due to heavy load, the latest workflow operation has been queued"--> 如何查看队列?