Export visible columns within a subset.
Export visible columns within a subset.
Hi there, first i'd like to say thanks to all the development team behind DataTables for providing this excellent plugin!
It amazes me everyday while discovering the incredible flexibility and great features it has!
Question:
I am using the export buttons extension along with the column visibility button. The thing is that my table has a few columns that should never be exported but that are always visible. I want to be able to export visible columns within a subset of columns.
Based on Column selectors Example
I know i can use
buttons: [
{
extend: 'excel',
exportOptions: {
columns: ':visible'
}
}
]
or
buttons: [
{
extend: 'excel',
exportOptions: {
columns: [0, 1, 2]
}
}
]
But i am after a combination of these. I mean, only select columns 0, 1, 2 that are visible.
I also read the documentation for the column-selector data type but couldn't figure it out.
Any help is appreciated
Thanks again for the great plugin!
Answers
I just figured it out, in case someone finds this useful:
I added
class="exportable"
to the headings of columns i want to be exportable, and then configured buttons like this: