这是用于动态创建复选框的UI网格条目
{
field: 'defaultYn',
displayName: 'DefaultYn',
width: '10%',
enableFiltering: false,
cellTemplate: '<input type="checkbox" ng-model="row.entity.defaultYn" ng-click="grid.appScope.updateRow(row);" ng-true-value="\'Y\'" ng-false-value="\'N\'">'
}
在updateRow中,需要以编程方式更新复选框值,
$scope.updateRow = function(row) {
SweetAlertService.confirm('Are you sure?','', function(isConfirmed) {
if (isConfirmed) {
}else{
/* deselect the check box, code not working
row.entity.defaultYn= "Y";*/
}
});
Sweet Alert代码部分
confirm: function(title, message, callback) {
swal({
title: title,
text: message,
type: "warning",
showCancelButton: true,
confirmButtonColor: '#33414e',
confirmButtonTexColor: '#FFF;',
closeOnConfirm: true,
closeOnCancel: true,
timer: 1500
},
function(isConfirm) {
callback(isConfirm);
});
}
此处无法以编程方式设置UI网格选定的行值复选框。 如何通过角度js代码启用或禁用UI网格中的复选框。