Search code examples
kendo-uikendo-gridkendo-datasource

DataSource transport.destroy called +1 times for each successive delete (recalled for previously deleted items)


I have a DataSource in my code that support destroy. In order to delete object from the it, i directly call remove, i.e.

myDataSource.remove(discardedData);

I get a behavior similar to this. However, unlike the linked thread, my destroy is not set to a function, so the solution does not help me.

My DataSource (i included all of it in case some of my configuration is to blame):

       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
    };

I cant find any clues as to why this is happening.


Solution

  • thanks to OnaBai I found the problem.

    consulting RFC 7231, i my changed the http DELETE response from 200 OK to 204 no content.