Kendo DataSource Transport.Destroy with function got called too much

断了今生、忘了曾经 提交于 2019-12-11 19:26:50

问题


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?


回答1:


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#/



来源:https://stackoverflow.com/questions/19403543/kendo-datasource-transport-destroy-with-function-got-called-too-much

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!