DataTables.js: export to excel and responsive features together
DataTables.js: export to excel and responsive features together
Hi guys, I wonder how to achieve a full set of options for my table rendered with DataTables.js.
I would like to have the export to excel button, autowidth and responsive features.
All the examples I found out usually cover one aspect only, for example how to show buttons, or how to build a responsive table.
But when I use these features combined, something went wrong and maybe I can build a responsive table with autowidth, but without export to excel button, or vice versa I have the export to excel but the table is no longer responsive.
This is an example of code used:
var table = $('.gridObject').DataTable({
dom: 'Blfrtip',
buttons: [{
text: 'Export To Excel',
extend: 'excelHtml5',
exportOptions: {
modifier: {
selected: true
},
},
footer: false,
customize: function (xlsx) {
var sheet = xlsx.xl.worksheets['sheet1.xml'];
},
"autowidth": false,
"responsive": true,
"language": {
"url": "Content/DataTables/language/dataTables.language.italian.json"
}
}]
});
What am I doing wrong?
Kind regards,
Lowelheim
This question has an accepted answers - jump to answer
Answers
It's because the last few options are incorrectly within the button configuration, if you move them out, you should be OK.
C