I am trying to add a "Download as a CSV File" button for my page which displays the data from a database. I have gone through their forums, but could not find a solution to my error.
I'm attaching the screenshots of he errors I get and the part of the code that it is pointing to. Please help me solve this error.
The code that it's referring to:
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.7/css/jquery.dataTables.css">
<script src = "https://cdn.datatables.net/tabletools/2.2.4/js/dataTables.tableTools.min.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/tabletools/2.2.4/css/dataTables.tableTools.css">
<script src="jquery.dataTables.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#leads_table thead th").each (function(){
var title = $("#leads_table thead th").eq( $(this).index()).text();
$(this).html (' <input type = "text" placeholder = "Search '+title+'"/> ');
});
var table = $('#leads_table').DataTable(
"dom": 'T<"clear">lfrtip',
"tableTools": {
"sSwfPath": "/swf/copy_csv_xls_pdf.swf"
}
);
table.columns().every(function(){
var that = this;
$( 'input', this.header() ).on ( 'keyup change', function(){
that
.search( this.value )
.draw();
} );
});
});
I'm new to using both Datatables and tableTools. So, any help would be appreciated.