I need help with export options
I need help with export options

I finally got things set up and working the way i want but the export option exports every row even when I have selected individual rows. Here is my code:
$(document).ready(function() {
var dataTable = $('#cases').DataTable( {
dom: 'B<"clear">lfrt<"bottom"ip>',
colReorder: true,
stateSave: true,
select: {
style: 'multi',
},
buttons: [
{
text: 'Add New Case',
action: function ( e, dt, node, config ) {
window.location = '/add-a-case/';
}
},
'colvis',
'selectAll',
'selectNone',
{ extend: 'collection',
text: 'Export',
buttons: ['copy', 'csv', 'excel', 'pdf', 'print']
}
]
} );
} );
Can you please take a look and tell me what I am missing. Thank you all so much!
This question has an accepted answers - jump to answer
Answers
Thank you for looking
This example should help you:
https://datatables.net/extensions/buttons/examples/print/select.html
Kevin
At this time Buttons will either export all rows (default) or export only selected rows (per the example from Kevin). It will not automatically detect if there are rows selected and if so export those rows, if not the export all. That is a feature I will be adding in a future version.
Allan
I got it working. Thank you all for your help. Where would I be without forums like this?