Button export csvHtml5 skip blank cells in export column
Button export csvHtml5 skip blank cells in export column
pikot
Posts: 1Questions: 1Answers: 0
Hi
Im trying to export a single column from my dataTables.
This column has blank cells and i would like to skip those when exporting so that the final text file would not contain blank lines.
This is my csvHtml5 button configuration:
{
text: '<i class="fas fa-file-code"></i> Ephem',
extend: 'csvHtml5',
fieldBoundary: '',
extension: '.txt',
filename: 'some_file',
exportOptions: {
columns: '.my_column',
trim: false,
stripHtml: false,
},
},
Thank you very much for your support
Best regard
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
Answers
You could use the
rows
option in thebuttons.exportData()
- similar to yourcolumns
. There, forrow-selector
you can make it a function, and only include that row if it's non-empty - the example on that page is only including rows that start with "A" so you could use that as a template.Colin