I have added this JavaScript if statement to my MVC 5 project however this does not add the table tools to the page, also I have no console errors.
if ($(".table").hasClass("ExportDataTable")) {
$('.table').dataTable({
"columnDefs": [
{ "type": "date", "targets": 0 }
],
"order": [[0, "desc"]],
responsive: true,
"dom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "http://cdn.datatables.net/tabletools/2.2.2/swf/copy_csv_xls.swf",
}
});
}
else {
$('.table').dataTable({
"columnDefs": [
{ "type": "date", "targets": 0 }
],
"order": [[0, "desc"]],
responsive: true
});
}