Im new to jQuery and JavaScript, I want to change the background color of a specific column if the if statement is true.
$('#myTable').DataTable({
"ajax": {
"url": "/project/loadClientData",
"type": "GET",
"datatype": "json"
},
"columns" :
[
{ "data": "name", "autoWidth": true, "bSortable": true},
{
"data": "active", "autoWidth": true, "bSortable": true, "mRender": function (data, type, full, meta)
{
if (full.active == true) {
// i wanna make this cell background green.
return 'Ja';
}
else {
return 'Nej';
}
}
}
]
});
Aucun commentaire:
Enregistrer un commentaire