我正在使用Kendo-UI来制作按钮delete all
。将点击事件绑定到Kendo-UI按钮
我写了这对toolbar
:
toolbar:["create", { name: "delete-all", text: "Delete All" }]
它的正常工作,并增加了在剑道网格的按钮。但现在我想添加点击事件到这个按钮。
我想在点击此按钮时显示警报(如hi
)。
怎么办?
谢谢。
我正在使用Kendo-UI来制作按钮delete all
。将点击事件绑定到Kendo-UI按钮
我写了这对toolbar
:
toolbar:["create", { name: "delete-all", text: "Delete All" }]
它的正常工作,并增加了在剑道网格的按钮。但现在我想添加点击事件到这个按钮。
我想在点击此按钮时显示警报(如hi
)。
怎么办?
谢谢。
我网
$("#grid").kendoGrid({
dataSource: dataSource,
navigatable: true,
pageable: true,
height: 430,
toolbar: ["Edit"],
columns: [
"ProductName",
{ field: "UnitPrice", title: "Unit Price", format: "{0:c}", width: 110 },
{ field: "UnitsInStock", title: "Units In Stock", width: 110 },
{ field: "Discontinued", width: 110 },
{ command: "destroy", title: " ", width: 90}],
editable: false
});
我的编辑按钮事件
$('.k-grid-Edit').on("click", function() {
alert('hi');
});
当您创建button
在kendo-grid-toolbar
剑道dynamicaly genarate button class
。 我在我的网格中编辑按钮,所以它的类是k-grid-Edit
。
初始化网格中添加以下代码后:
$('.k-grid-delete-all').on("click", function() {
alert('hi');
});
基本上,你需要使用如选择一个CSS类,它是串联.k-grid-
的结果和你的button
在toolbar
的name
定义处理程序。