gpt4 book ai didi

javascript - 如何判断剑道 UI 网格中的 destroy 命令销毁了什么?

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:02:41 24 4
gpt4 key购买 nike

我正在使用 Kendo UI 2013.2.716 和 JQuery 2.0.3,我正在放置 grid在我的页面上,我的问题是:

Does anyone know how to tell what has been destroyed by the destroy command from the grid?

例如:

<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
<link href="kendo.common.min.css" rel="stylesheet" />
<link href="kendo.default.min.css" rel="stylesheet" />
<script type="text/javascript" src="jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="kendo.all.min.js"></script>
</head>
<body>
<div id="grid"></div>
<script type="text/javascript">
$(document).ready(function() {
var products = [];
for(var i = 1; i <= 40; i++) {
products.push({
ProductId: i,
ProductName: "Product " + i
});
}
$("#grid").kendoGrid({
dataSource: {
data: products,
schema: {
model: {
id: "ProductId",
fields: {
ProductName: { type: "string" },
}
}
},
requestEnd: function (e) {
if (e.type === "destroy") {
alert("OK, so something got destroyed, but what??");
}
}
},
editable: "inline",
columns: [
"ProductName",
{ command: "destroy", title: " ", width: "100px" }
]
});
});
</script>
</body>
</html>

我在 documentation 中找到了 requestEnd 回调但我完全不知道被销毁的元素在哪里。我只需要项目的 ID,以便我可以适本地更新页面的其他部分。

我想知道我是否需要事先以某种方式捕获它。

最佳答案

您需要在数据源上配置transport 对象。在您当前的配置中,真的有任何东西被破坏了吗?当然,该项目可能会从您的网格中消失,但我想知道它是否仍在数据源中。也许这就是您的意图。

http://docs.kendoui.com/api/framework/datasource#configuration-transport.destroy

如果您只是在寻找一种方法来获取正在销毁的数据,请连接到 transport 对象的 parameterMap() 函数。在那里你可以在操作执行之前操作被删除的对象。

http://docs.kendoui.com/api/framework/datasource#configuration-transport.parameterMap

关于javascript - 如何判断剑道 UI 网格中的 destroy 命令销毁了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18379613/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com