如何获取或修改Kendo MVC Grid Destroy Command确认消息OK按钮事件?
实际上,我想在单击 Destroy 确认框的“确定”按钮后隐藏/删除所有自定义验证消息。
我已经尝试了某些方法来获取删除事件的访问权限。例如:
$(".k-button.k-button-icontext.k-grid-delete").live('click', function (e) {
alert('delete');
});
但是,这会在默认点击事件之后触发,并且会在“确定”和“取消”之后触发。因此,我无法确定哪个是“确定”事件,哪个是“取消”事件。
谁能告诉我怎么做?
仅供引用,我正在使用 Kendo MVC Grid 开发 ASP.NET MVC4。
最佳答案
我认为您可以创建自定义命令按钮并调用自定义函数
columns.Command(command => command.Custom("Delete").Click("deleteRow"));
禁用DisplayDeleteConfirmation以防确认窗口显示两次
.Editable(editable => editable
.Mode(GridEditMode.InCell)
.DisplayDeleteConfirmation(false))
这是你的自定义删除函数
function deleteRow(e) {
e.preventDefault ? e.preventDefault() : e.returnValue = false;
var grid = $("#grid").data("kendoGrid");
if (confirm("Are you sure you want to delete the selected record(s)?")) {
grid.removeRow($(e.target).closest("tr")); // remove the row
// custom actions here
} else {
// cancel button is clicked
}
}
关于asp.net-mvc - 如何获取剑道 mvc 网格销毁命令确认消息事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18072184/