new DataTable('#SpfxDatatable', {
pageLength: 10,
language: { "search": "Filter: " },
retrieve: true,
responsive: true,
scrollCollapse: true,
scrollY: '50vh',
buttons: [{ text: 'Show all groups', action: function () { alert('Clicked'); }, className:'hideEmptyButton' }],
layout: {
topStart: {
buttons: [
'copy', 'excel', 'pdf'
]
},
topEnd: 'search',
bottomStart: 'info',
bottomEnd: 'paging'
}
})
When i use DOM opttions all the features align left. When I try to use layouts, buttons is not available.
I am using it in a spfx solution with react and have imported all the necessary components.
import 'datatables.net-buttons-dt';
import 'datatables.net-dt/css/dataTables.dataTables.min.css';
import 'datatables.net-responsive-dt';
import DataTable from 'datatables.net-dt';
Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.