≡

Excel export regression when adding columns in customizeData

Excel export regression when adding columns in customizeData

peter.brunspeter.bruns Posts: 2Questions: 2Answers: 0

Link to test case new version (failing 3.1.3): https://live.datatables.net/picazufe/1/edit
Link to test case old verison (working 2.3.4): https://live.datatables.net/yetuviba/1/edit

Error messages shown: dataTables.buttons.js:997 Uncaught TypeError: Cannot read properties of undefined (reading 'includes')

Description of problem:

Hi,

I think I found a regression in the Excel export after upgrading from DataTables 2.x to 3.x.

My setup previously worked with:

  • DataTables 2.3.4
  • Buttons 3.2.5

After upgrading to DataTables 3.x, Excel export fails if I add extra export-only columns inside exportOptions.customizeData and also update headerStructure / footerStructure.

The export fails in addRow at:

columnTypes[i].includes('num')

For the added export column, columnTypes[i] is undefined. It looks like columnTypes is still based on the original DataTable columns, while the customized export data now contains additional columns.

Interestingly, adding the extra values only to header, footer, and body does not trigger the error. It starts failing once I also add the corresponding entries to headerStructure / footerStructure.

However, without updating headerStructure / footerStructure, the added columns don't appear correctly in the exported header/footer.

The same customization works with DataTables 2.3.4.

Is this an unintended regression, or has the expected way of adding export-only columns changed in DataTables 3.x?

Sign In or Register to comment.