DataSource transport.destroy为每次连续删除调用+1次(为之前删除的项目调用)

时间:2014-10-20 14:32:32

标签: kendo-ui kendo-grid kendo-datasource

我的代码中有DataSource支持destroy。为了从中删除对象,我直接调用remove,即

myDataSource.remove(discardedData);

我得到类似于this的行为。但是,与链接线程不同,我的destroy未设置为函数,因此解决方案对我没有帮助。

我的DataSource(我包括所有这些以防我的一些配置应该受到责备):

       var QueueMessages = {
        type: "aspnetmvc-ajax",
        transport: {
            read: {
                url: BASE_URL + "api/QueueMessages/GetMessagesHeaders",
                dataType: "json",
                type: "GET",
                beforeSend: function (req) {
                    req.setRequestHeader('Authorization', authService.getAuth());
                }
            },
            destroy: {
                url: BASE_URL + "api/QueueMessages/deleteMessage",
                dataType: "json",
                type: "DELETE",
                beforeSend: function (req) {
                    req.setRequestHeader('Authorization', authService.getAuth());
                }
            }
        },
        schema: {
            model: {
                id: "id",
                fields: {
                    profileName: { type: "string" },
                    queueType: { type: "string" },
                    acceptedAt: { type: "date" },
                    processedAt: { type: "date" },
                    BodyExcerpt: { type: "string" }
                }
            },
            total: "total",
            data: "data",
        },
        error: function (e) {
            //throw user back to login page
            if (e.errorThrown === "Unauthorized")
                $rootScope.$apply($location.path('/'));
        },
        requestStart: function () {
        },
        requestEnd: function () {
        },
        pageSize: 50,
        serverPaging: true,
        serverFiltering: true,
        serverSorting: true,
        serverGrouping: true,
        serverAggregates: true
    };

我无法找到有关为何发生这种情况的任何线索。

1 个答案:

答案 0 :(得分:1)

感谢OnaBai我发现了问题。

咨询RFC 7231,我将http DELETE回复从200 OK更改为204 no content