Support input fields in export

Support input fields in export

StickmanStickman Posts: 3Questions: 2Answers: 0

I have input fields in my DataTable (that only support numeric values). Values ​​from input fields are not included in the export. I've tried different approaches, but I still can't get DataTable to export values ​​from input fields.

I made live example: https://live.datatables.net/benodima/1/edit

I would also like background-color to be visible during export, both in Excel and PDF, but this is a side topic and probably for another thread.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,441Questions: 1Answers: 10,465 Site admin
    Answer ✓

    You need to use an export formatting function to get the data from the input elements.

    I would also like background-color to be visible during export, both in Excel and PDF, but this is a side topic and probably for another thread.

    For PDF, you'll need to refer to the pdfmake documentation on how to manipulate the document structure to do that. We provide a customize callback to give access to the object Buttons' export makes so you can modify it to your needs. Example showing customization of the document is here.

    Excel is harder unfortunately, you need to modify the XML created (again using the customize callback for that button). There are a number of built in styles and this example shows how it might be done. The real fun begins if you need to add custom background colours. Excel is a b***h to work with for that. One day I'll write more of an abstraction layer. One day...

    Allan

  • StickmanStickman Posts: 3Questions: 2Answers: 0

    allan, thank you for your help. Since your post, I was able to show input fields immediately, so that's great. So far, however, I am struggling with exporting to Excel and PDF and I am close to giving up ;) My programming knowledge is not so good and I have been sculpting for a very long time and in the end my own colors do not exist, not to mention inserting photos. I think I'll have to use some other export environment. While the DataTable itself is brilliant and has helped me a lot, the exports are quite difficult. Thanks!

Sign In or Register to comment.