Haris Khan
Haris Khan

Reputation: 125

use multiple column selectors jQuery datatable export CSV?

I am trying to export the datatables to CSV and it is working fine. I want to exclude first and last column while exporting, additionally I also want to export only visible columns. Here is what I am doing :

"buttons": [{
    extend: 'csvHtml5',
    exportOptions: {
        columns: [':visible',':not(:last-child,:first-child)']
    }
 }

If I remove :visible the other one starts to work fine and same is the case with the other. But I want to use both at the same time. I am using datatable export for the first time. Sorry for any inconvenience, any help would be appreciated.

Upvotes: 1

Views: 657

Answers (1)

O. Borcuhin
O. Borcuhin

Reputation: 244

I think you can use something like this instead:

columns: [':not(:last-child,:first-child):visible']

Upvotes: 2

Related Questions