Select header rows to export for multi-row header table with buttons 3.0.0

Select header rows to export for multi-row header table with buttons 3.0.0

afzhchafzhch Posts: 2Questions: 1Answers: 0

Buttons 3.0.0 now has proper support for multi-row headers and footers, see:
https://cdn.datatables.net/buttons/3.0.0/

However it might not always be desired to export all header (or footer) rows. What is therefore missing is a way to select which header (or footer) rows should be exported.

As it is possible to select which columns to export and which rows to export in the table body, it would also be great to be able to select which rows of the header and footer to export.

Or is there a way to do this already with buttons 3.0.0 (or 3.0.1)

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Good idea. There isn't a simple option for that at the moment, but I can look into that.

    The workaround at the moment would be to use the customizeData option of the export options for each button to modify the headerStructure and footerStructure arrays, to delete the rows you don't want.

    Allan

  • afzhchafzhch Posts: 2Questions: 1Answers: 0

    Thank you so much @allan, the customizeData option is exactly what I was looking for!

    I used it like this to remove the second header row:

    customizeData : function(data) {
      data.headerStructure.pop();
    }
    
Sign In or Register to comment.