Search code examples
javascriptkendo-uidatasourcekendo-mobile

Kendo DataSource Transport.Destroy with function got called too much


I've got a strange problem using transport.destroy:

I have a Listview with a swipe event to open the delete option. (like most apps)

i did implement this: http://demos.kendoui.com/mobile/listview/editing.html#/ in my app. everything work fine, except destroy am listview item will be called for X+1 (x = deleted items)

At first deletion it will be called once, at the 2nd time it will be called twice and so on.

Here is the JSBin: http://jsbin.com/AGAGUfE/11/ You can see it within the console for each delete you will receive an addition call.

Do you see where en error could be?


Solution

  • The problem is that you are not saying that the destroy succeeded (options.success();)so next time that you invoke a delete it will try to delete again previous records.

    Try destroy as:

    destroy: function (options) {
        console.log("1");
        movies.splice(options.data.ProductID, 1);
        options.success();
    }
    

    Try it here : http://jsbin.com/AGAGUfE/14#/