I'm trying to add text to my data before creating a table with jQuery DataTables.
For example, my JSON data is [1,5,6,12] and I want to present it as [1 seconds, 5 seconds, 6 seconds, 12 seconds].
JavaScript:
$(document).ready(function () {
$('#utilisation').DataTable({
dom: 'Bfrtip',
buttons: [
'print'
],
'ajax': {
"type": "POST",
"url": '../Servlet?',
"dataSrc": ""
},
'columns': [
{"data": "router"},
{"data": "local"},
{"data": "startdate"},
{"data": "enddate"},
{"data": "duration"}
]
} );
});
#utilisation. Maybe this can be done in a callback whenDataTablegets the data. Inside this callback before it is sent to the target you can manipulate the strings.