How to use excel button in SPFx
How to use excel button in SPFx
Deep Dhanotiya
Posts: 2Questions: 1Answers: 0
Hi,
I need to use excel button in SPFx to export table in excel format. But using buttons npm packages i am not able to use excel button.
Can anyone please let me know that how we can use excel button in SPFx.
Thanks
This discussion has been closed.
Answers
This thread should help, it's asking the same thing.
Cheers,
Colin
$('#reports').DataTable({
"stripeClasses": [
'odd', 'even'
],
columns: [
{ title: "Item#" },
{ title: "Min level" },
{ title: "Max level" },
{ title: "Currnet on hand inventory" },
{ title: "Pending quantity to receive" },
{ title: "Category" },
{ title: "Fixed location" }
],
'columnDefs': [{
'targets': "nosort",
'orderable': false
}],
dom: 'Bfrtip',
buttons: [
'excel'
]
});
In above code while using "buttons" getting error on that. Is there any solution for that?
Without knowing what the error is, it's hard to say... Can you link to your page so we can take a look, please,
Colin
Hello, Buttons settings are not available in SPFx,
Could not find a declaration file for module 'datatables.net-buttons-dt'. '....../node_modules/datatables.net-buttons-dt/js/buttons.dataTables.js' implicitly has an 'any' type.
Try
npm i --save-dev @types/datatables.net-buttons-dt
if it exists or add a new declaration (.d.ts) file containingdeclare module 'datatables.net-buttons-dt';
ts(7016)I'm try to install @types/datatables.net-buttons-dt but do not exists
This SO thread should help, there's several techniques to avoid this error,
Colin
In my case, I realized that I was importing npm i --save-dev @types/datatables.net-buttons-dt insted of npm i --save-dev @types/datatables.net-buttons (without -dt)