Export Selected rows

Export Selected rows

Chandru12Chandru12 Posts: 1Questions: 1Answers: 0

I am very new to Data Tables
I have used the following code, am trying to export the selected rows into excel. it is always taking the full table.

$(document).ready( function () {
var table = $('#example').DataTable({

    dom: 'Bfrtip',
    buttons: [
         'excel',
         {
             extend: 'excel',
             text: 'Print selected',
             exportOptions: {
                 modifier: {
                     selected: true
                 }
             }
         }
    ],

});  
$('#example tbody').on('click', 'tr', function () {
    $(this).toggleClass('selected');
});

}
);

Please help me in proceed on the correct direction

This question has an accepted answers - jump to answer

Answers

  • piempiem Posts: 5Questions: 0Answers: 1
    Answer ✓

    Hi
    exportOptions: {rows: { selected: true }}

This discussion has been closed.