I am getting an error message on this code and nothing appears on my web page except . What's wrong?
I am getting an error message on this code and nothing appears on my web page except . What's wrong?
/* Formatting function for row details - modify as you need */
function format ( d ) {
// d
is the original data object for the row
return '
Courriel: | '+ ''+d.courriel+' | '+ '
Bureau: | '+ ''+d.bureau+' | '+ '
TelephoneCRM: | '+ 'And any further details here (images etc)... | '+ '
';
}
$(document).ready(function() {
var table = $('#example').DataTable( {
"ajax": "ajax/data/objects.txt",
"columns": [
{
"class": 'details-control',
"orderable": false,
"data": null,
"defaultContent": ''
},
{ "data": "name" },
{ "data": "position" },
{ "data": "status" },
{ "data": "affiliation" }
],
"order": [[1, 'asc']]
} );
// Add event listener for opening and closing details
$('#example tbody').on('click', 'td.details-control', function () {
var tr = $(this).closest('tr');
var row = table.row( tr );
if ( row.child.isShown() ) {
// This row is already open - close it
row.child.hide();
tr.removeClass('shown');
}
else {
// Open this row
row.child( format(row.data()) ).show();
tr.addClass('shown');
}
} );
} );