I need help with export options

I need help with export options

cemfundogcemfundog Posts: 6Questions: 2Answers: 0
edited May 2017 in Free community support

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

  • cemfundogcemfundog Posts: 6Questions: 2Answers: 0
    edited May 2017

    Thank you for looking

  • kthorngrenkthorngren Posts: 21,167Questions: 26Answers: 4,921
  • allanallan Posts: 63,205Questions: 1Answers: 10,415 Site admin
    Answer ✓

    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

  • cemfundogcemfundog Posts: 6Questions: 2Answers: 0

    I got it working. Thank you all for your help. Where would I be without forums like this?

This discussion has been closed.