2 of 5 buttons do not work.
2 of 5 buttons do not work.
JeremiahEdward
Posts: 25Questions: 4Answers: 0
I have the button Copy, CSV, EXCEL, PDF, Print on my table.
the Copy and CSV button do not work for some reason. All other buttons work fine.
My extensions:
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css"/>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.0.3/css/buttons.dataTables.min.css"/>
<link rel="stylesheet" href="src/L.Control.Sidebar.css"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.print.min.js"></script>
<script src="https://cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/pdfmake.min.js"></script>
<script src="https://cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/vfs_fonts.js"></script><script src="https://cdn.datatables.net/buttons/1.0.3/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/tabletools/2.2.2/swf/copy_csv_xls_pdf.swf"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js"></script>
The tables are created dynamically and placed into a div container (set up ahead of time). My creation code:
$(document).ready(function() {
var columns = [];
var prop = data.features[0].properties;
for (var i in prop) {
columns.push({data: 'properties.' + i, title: i});
}
var btnPart = '<button class="accordion"><b>' + 'Selection ' + tableCount.toString() + '</b>: ' + activeOverlay.toString().toUpperCase()+ '</button>';
var panelPart = '<div class="panel" id="panel' + panelCount.toString() + '">';
var tabContPart = '<div class="container" id="tableContainer' + tableContainerCount.toString() +'">';
var tablePart = '<table id="featureTable' + tableCount.toString() + '" class="display" width="100%"><thead></thead> <tfoot></tfoot></table></div></div></div>';
$('#accordionContainer').append(btnPart + panelPart + tabContPart + tablePart);
var newTable = '#featureTable' + tableCount.toString();
$(newTable).DataTable( {
data: data.features, //get the data under features
columns: columns,
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
],
destroy: true
} );
tableContainerCount++;
tableCount++;
panelCount++;
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
It looks lke you are loading the tabletools version of copy and csv. These are retired per this document:
https://datatables.net/extensions/tabletools/
Instead you will need to load either the html5 (recommneded) or flash buttons JS. See these pages:
https://datatables.net/extensions/buttons/built-in
https://datatables.net/download/release
Kevin
Thanks Kevin.
I have updated my JS extensions, bu they still do not work. Here are my JS links:
The version should match the other buttons: 1.3.1.
Kevin
I'm an idiot! I've got blinders on today or something.................
Sometimes it takes an extra set of eyes.
Kevin