I have a jQuery datatable using AJAX. I would like to have two fields together in one column and also use if statements for both fields.
I can do two fields together:
{
"data" : function (data, type, dataToSet) {return data.primary + "<br/>" + data.proctor;
}},
I have added some styling a based off an if statement:
{
"data" : "primary",
"render" : function(primary) {
if (!primary) {
return '<i class="fa fa-ban"></i> primary';
} else {
return '<i style="color: green" class="fa fa-check"></i> primary';
}
}
},
{
"data": "proctor",
"render": function (proctor) {
if (!primary) {
return '<i class="fa fa-ban"></i> proctor';
} else {
return '<i style="color: green" class="fa fa-check"></i> proctor';
}
}
},
How would I combine the two fields into one column and still have the if/else statement?