Excel Button option not shown in SPFx webparts
Excel Button option not shown in SPFx webparts
Hi,
I want to export my data into excel.
when I'm using export option in data table. I'm getting export options like csv and print options only except excel button
how to solve this. I added all references for export options. help me to figure out this.
Note: Its not working only in SPFx webparts.
Here is my code.
$('#UserTimehseetExport').DataTable( {
dom: 'Bfrtip',
select: true,
destroy:true,
colReorder: true,
buttons: [
{
extend: 'collection',
text: 'Export Records',
buttons: [
'excel',
'csv',
'print'
]
}
]
} );
This question has an accepted answers - jump to answer
Answers
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
My guess is that you haven't loaded the JSZip library? Otherwise, as Colin says, we'd need a test case.
Allan
Hi Allan,
You were correct. The issue with the JSZip lib loading.
instead of using cdn path i used the below.
import * as JSZip from 'jszip';
then before the datatable method call
window["JSZip"] = JSZip;
found the answer from the following discussion.
https://datatables.net/forums/discussion/63040/can-we-integrate-datatable-with-excel-export-in-a-sharepoint-spfx-webpart