Мне нужно включить или отключить флажок в базе данных для значения столбца «Состояние». Я хочу, чтобы флажок был отключен, когда статус «Закрыт». Я знаю, что могу перестать отображать закрытый тикет, изменив предложение where в моем запросе. но я хочу, чтобы пользователь мог видеть все билеты
Настольный дисплей
![enter image description here](https://i.stack.imgur.com/Zujjf.png)
C # код
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
// 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="+@ViewBag.id,
"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();
}