I need enable or disable the checkbox in my datatable base of the value of the 'Status' column. I want the checkbox to be disable when the status is "Closed". I know I can stop displaying the close ticket by changing the where clause in my query. but i want to user to be able to see all tickets
Table display
C# Code
public ActionResult GetChildTickets1(int id)
{
_db.Configuration.ProxyCreationEnabled = false;
IQueryable<VmRequest> results = _db.VmRequests.Where(i => i.ParentId == id) ;
return Json(results, JsonRequestBehavior.AllowGet);
}
JQuery Code
// Datatable value from the database
var enabletemplateListVM;
function tchildticket () {
enabletemplateListVM = {
dt: null,
init: function () {
dt = $('#childtable').DataTable({
"pageLength": 10,
"ajax": {
// Url
"url": "/Home/GetChildTickets1?id="[email protected],
"type": "POST",
"datatype": "json",
"dataSrc": function (d) {
return d
}
},
// Table Columns to display the data
"columns": [
{
"targets": [0],
"data": "Id", "autoWidth": true,
"render": function (data, type, full) {
return '<input type="checkbox" id="cticket" name="cticket" value="' + full.Id + '"/>';
},
},
{ "title": "Ticket Id", "data": "Id", "name": "Id" },
{
"title": "Logged On", "data": "CreatedOn", "name": "CreatedOn",
// Date Formating
render: function (data, type, full, meta) {
if (data !== null) {
return (moment(data).format("DD/MM/YYYY"));
} else {
return '';
}
}
},
{ "title": "Ticket Type", "data": "TypeofWork", "name": "TypeofWork" },
{ "title": "Subject", "data": "Subject", "name": "Subject" },
{ "title": "Contact", "data": "ContactId", "name": "ContactId" },
{ "title": "Status ", "data": "CurrentStatus", "name": "CurrentStatus" },
{ "title": "Team", "data": "Teamid", "name": "Teamid" },
],
});
}
}
enabletemplateListVM.init();
}
