I have datatables returning the data using server side processing. I have not modified the basic example given from data tables.
I have some boolean columns that I want to render as icons e.g. 1 = Green tick 0 = red cross or something similar. It currently looks like this. How would I go about rendering just 3 columns?
here's the code, i've tried, however this results in the whole table being blank...
$(document).ready(function() {
$('#log').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "assetlog.php"
"columns": [
{ "data": "id" },
{ "data": "assetcode" },
{ "data": "name"},
{ "data": "shift" }
{ "data": "datetime" },
{ "data": "stop_production" },
{ "data": "furtheractions" }
{ "data": "jobcomplete" },
{ "data": "duration" },
],
"columnDefs": [
{
"render": function (data, type, row) {
return (data === true) ? '<span class="glyphicon glyphicon-ok"></span>' : '<span class="glyphicon glyphicon-remove"></span>';
},
"targets": 6
}
]
} );
} );
Thanks