[英]how to disable button in kendo grid column
I need to have 2 buttons in a cell. 我需要在一个单元格中有2个按钮。 One is calling some function, other is disabling previous button that calls some function. 一种是调用某些功能,另一种是禁用调用某些功能的上一个按钮。 I tried this(part of my template in a column): 我尝试了这个(我的模板的一部分在专栏中):
return '<button kendo-button class="validate" ng-click="MyFunction($event)">' + txt.TXT_SEND_TO_SAP + '</button>' + ' ' +
'<button kendo-button ng-click="Disable($event)">disable</button>' + ' '
and this function that calls disabling: 和此函数调用禁用:
$scope.Disable = function (e) {
var data = $scope.grid.dataSource.view();
for (var i = 0; i < data.length; i++) {
$(data[i]).prev().prop("disabled", true)
}
}
what I do wrong? 我做错了什么? Thanks 谢谢
The event parameter (e) gives you the clicked button, e.target
. 事件参数(e)为您提供了单击的按钮e.target
。 From that you can get the button to disable via .prev(".validate")
and then use the KendoUI widget to disable it: 由此,您可以通过.prev(".validate")
获取禁用按钮,然后使用KendoUI小部件将其禁用:
$scope.Disable = function (e) {
var btn = $(e.target);
var toDisable = btn.prev(".validate").data("kendoButton");
toDisable.enable(false);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.