Buttons extension installed, get nothing but empty div
Buttons extension installed, get nothing but empty div
Hi all, I am stumped on trying to use the Buttons extension from https://datatables.net/extensions/buttons/
Here is my setup. I have installed it by npm, and my html is sourcing these datatables related files, in this order:
datatables.net-bs/css/dataTables.bootstrap.css
datatables.net-buttons-bs/css/buttons.bootstrap.css
datatables.net/js/jquery.dataTables.js
datatables.net-bs/js/dataTables.bootstrap.js
datatables.net-buttons/js/dataTables.buttons.js
datatables.net-buttons-bs/js/buttons.bootstrap.js
I have tried all of the various methods to instantiate the buttons as described in the https://datatables.net/extensions/buttons/
What I see is an empty div gets created, with no buttons:
<div class="dt-buttons btn-group"></div>
Here is my current method of instantiating:
let table = $(this.table).DataTable(this.datatableOpts());
let buttons = new $.fn.dataTable.Buttons( table, {
buttons: [ 'copy', 'csv', 'excel', 'pdf']
});
buttons.container().appendTo($(this.tableButtons));
Please let me know any suggestions or what I am overlooking. Thanks so much!
This question has an accepted answers - jump to answer
Answers
I was able to solve by using the download builder of datatables. So I was probably just missing the dependencies by trying to install by npm before.