Button export csvHtml5 skip blank cells in export column

Button export csvHtml5 skip blank cells in export column

pikotpikot Posts: 1Questions: 1Answers: 0
edited May 2022 in Free community support

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>&nbsp;&nbsp;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

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    edited May 2022

    You could use the rows option in the buttons.exportData() - similar to your columns. There, for row-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

Sign In or Register to comment.