Ramco Ramco

Ramco Ramco

  • 441
  • 3.4k
  • 523.1k

How to disable Delete

Jun 2 2021 3:44 PM
Hi
 
   With the below code how i can disable Delete button if IsActive = "N"
 
$('#tblLocation').DataTable({
"ajax": {
"url": '/Location/List',
"type": "get",
"datatype": "json",
dataSrc: ""
},
paging: true,
sort: true,
pageLength: 10,
searching: true,
"columns": [
{ "data": "Id", "autoWidth": true },
{ "data": "Description", "autoWidth": true },
{ "data": "IsActive", "autoWidth": true },
{
"data": "Id", "render": function (data) {
return "<a class='btn btn-primary btn-sm' data-Id=" + data + " id='btnEdit'><i class='fa fa-pencil'></i> Edit</a> <a class='btn btn-danger btn-sm' data-Id=" + data + " id='btnDelete' style='margin-left:5px' ><i class='fa fa-trash'></i> Delete</a>";
}
}
]
});
 
 
Thanks 

Answers (1)