Kendo DataSource Transport.Destroy函数调用过多 [英] Kendo DataSource Transport.Destroy with function got called too much

查看:167
本文介绍了Kendo DataSource Transport.Destroy函数调用过多的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用transport.destroy时遇到一个奇怪的问题:

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

我有一个带有滑动事件的Listview,用于打开删除选项. (像大多数应用一样)

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

我确实实现了这一点: http://demos.kendoui.c​​om/mobile /listview/editing.html#/在我的应用中. 一切正常,除非销毁listview项目会被要求X + 1(x =已删除的项目)

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.

这是JSBin: http://jsbin.com/AGAGUfE/11/ 您可以在控制台中看到它,每次删除都会收到一个附加呼叫.

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?

推荐答案

问题是您不是在说destroy成功(options.success();),所以下次您调用删除操作时,它将尝试再次删除以前的记录.

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.

尝试将destroy设置为:

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

在这里尝试: http://jsbin.com/AGAGUfE/14#/

这篇关于Kendo DataSource Transport.Destroy函数调用过多的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆