Export buttons - only export filtered data?

Export buttons - only export filtered data?

emf411emf411 Posts: 5Questions: 2Answers: 1

I'm trying to figure out how to export only filtered rows in my DataTable but I can't seem to get the right combination of code to work.

This is my table
var table = $('#myTable').DataTable();

This is my filtered data
var visibleRows = $('#myTable tr:visible');

Can anyone help me with how to configure the Excel Export button to just export the "visibleRows"?

Thank you!!

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,344Questions: 26Answers: 4,954
    Answer ✓

    I think by default export will export the data as filtered. If you want to export only the current page then you can add this export option to your button config:

    exportOptions: {
      rows: ':visible'
    }
    

    Kevin

  • emf411emf411 Posts: 5Questions: 2Answers: 1

    Thank you very much Kevin, that was exactly what I was looking for!

This discussion has been closed.