Reactjs - want to add Excel export button
Reactjs - want to add Excel export button
bvmcode
Posts: 2Questions: 1Answers: 1
I've been having issues trying to add an excel export button when working in React. I assume it has something to do with an import. I just want a user to be able to download to excel.
these are my imports
$.DataTable = require('datatables.net');
import 'datatables.net-dt/css/jquery.dataTables.css'
here is where the table is defined. It works except for the buttons
this.$el.DataTable({
dom: 'Bfrtip',
data: this.makeArray(),
columns: this.getColumns(),
pageLength:this.props.json.length,
buttons: [
{
extend: 'excel',
text: 'Save current page',
fileName: "data.xlsx",
exportOptions: {
modifier: {
page: 'current'
}
}
}
]
});
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
answered my own question
needed to do add jzip
const jzip = require( 'jzip');
window.JSZip = jzip;