更新后,Kendo网格更新行不在预期的位置

时间:2014-05-13 22:17:56

标签: kendo-ui kendo-grid

我有一个带有内联可编辑模式的Kendo网格。当我尝试更新一行时,只是在更新后它会消失或与其他所有条目混淆。

刷新网格或再次登录似乎再次出现在正确的位置。

我想将更新的行(内联可编辑模式)放在同一个地方。

我的网格在那里

var grid = $("#grid").kendoGrid({
    dataSource: {

        transport: {
            read: {
                url: "GetTaskAllocationGrid",
                type: "POST",
                contentType: "application/json",
                dataType: "json"
            },

            update: {
                url: "UpdateTaskAllocationData",
                contentType: "application/json",
                type: "POST",
                dataType: "json",
                complete: function (data) {

                    var result = jQuery.parseJSON(data.responseText);

                    if (result.State == true)
                    {
                        toastr.success(result.Description);
                        //$("#grid").data("kendoGrid").dataSource.read();
                    }
                    else
                    {
                        toastr.error(result.Description);
                    }
                    $("#grid").data("kendoGrid").dataSource.read();
                }
            },
            destroy: {
                url: "DestroyTaskAllocation",
                contentType: "application/json",
                type: "POST",
                dataType: "json",
                complete: function (data) {
                    var result = jQuery.parseJSON(data.responseText);

                    if (result.State == true) {
                        toastr.success(result.Description);
                    }
                    else {
                        toastr.error(result.Description);
                    }
                    $("#grid").data("kendoGrid").dataSource.read();
                }
            },
            create: {
                url: "CreateTaskAllocation",
                contentType: "application/json",
                type: "POST",
                dataType: "json",
                complete: function (data) {
                    var result = jQuery.parseJSON(data.responseText);

                    if (result.State == true) {
                        toastr.success(result.Description);
                    }
                    else {
                        toastr.error(result.Description);
                    }
                    $("#grid").data("kendoGrid").dataSource.read();
                }
            },
            parameterMap: function (data, operation) {
                if (operation != "read") {
                    return kendo.stringify(data.models);
                }

            }
        },

        serverPaging: false,
        pageSize: 10,
        batch: true,

        schema: {
            model: {
                id: "IDChargedTaskCatagory",
                fields: {
                    IDChargedTaskCatagory: { editable: false },
                    Task: { editable: true },
                    ChargeRate: { editable: true },
                    TaskReportingMetrices: { editable: true }
                }
            },
            errors: "Errors"
        },

        error: function (e) {
            alert(e.errors + "grid");
        }
    },
    editable:
        {
            mode: "inline",
            createAt: "bottom"
        },
    pageable: {
        refresh: true,
        pageSizes: true
    },
    toolbar: [
    {
        name: "create",
        text: "Add new record"
    }
    ],
    sortable: false,
    autoBind: false,
    create:function(e)
    {
        alert("create");
    },

    edit: function (e) {

    },
    update: function (e) {
    },
    columns:
    [
        { field: "IDChargedTaskCatagory", width: 50, hidden: true, title: "ID" },
        { field: "Task", width: 100, title: "Task Name" },
        { field: "ChargeRate", width: 100, title: "Charge Rate", editor: ChargeRateDropDownEditor },
        { field: "TaskReportingMetrices", width: 100, title: "Task Metric", editor: TaskMetricsDropDownEditor },
        { command: ["edit", "destroy"], title: "Action", width: "175px" }
    ]
});

任何人都有任何明智的想法,对我来说非常有帮助。

0 个答案:

没有答案