Buttons - copy, excel etc not shown
Buttons - copy, excel etc not shown
I must be missing something here, I have a datatable with editor, and i have new, edit and delete buttons visible and working on my page.
I want to be able to add copy and excel export, so I have simply added them to the buttons [ ] list, but they do not appear.
buttons: [
{
extend: "create",
editor: editor,
formButtons: [
'Create',
{ label: 'Cancel', fn: function () { this.close(); } }
]
},
{
extend: "edit",
editor: editor,
formButtons: [
'Edit',
{ label: 'Cancel', fn: function () { this.close(); } }
]
},
{
extend: "remove",
editor: editor,
formButtons: [
'Delete',
{ label: 'Cancel', fn: function () { this.close(); } }
]
},
'csv', 'excel', 'pdf'
]
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Try to add this before buttons:
dom: 'Bfrtip'
yourDt.DataTables(
dom: 'Bfrtip'
buttons: ......)
thanks for the reply
i only posted the buttons code, but here is the full table js, as you can see, B is already added to the dom
It is missing the dependencies for those button types. You need to include
buttons.html5.js
at a very minimum. For Excel you need JSZip as a dependency and for PDF you need pdfmake.The download builder will help resolve these dependencies.
Allan
Thanks Allan,
I recently updated the buttons extension, - downloaded as a release package, and the extras are not included in the file.
I didn't realise until rereading the documentation that the buttons wouldn't be rendered without these xtra files, I expected a non functioning button if there was a problem