Can "File Export" buttons be made to exclude hidden columns?

Can "File Export" buttons be made to exclude hidden columns?

abh555abh555 Posts: 6Questions: 2Answers: 0

I was able to make the sample work in my program very easily, but my table contains hidden columns I want to exclude from the export. Is there any simple way to exclude the hidden columns from the export?

https://datatables.net/extensions/buttons/examples/initialisation/export.html

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,150Questions: 26Answers: 4,736
    Answer ✓

    See if this column selector example helps:
    https://datatables.net/extensions/buttons/examples/html5/columns.html

    Kevin

  • abh555abh555 Posts: 6Questions: 2Answers: 0

    Thanks Kevin, that was very helpful. I was able to get the desired result, but had to list the column numbers. I couldn't get "columns: ':visible'" to work -- I assume the intent is for it to include only visible columns?

  • allanallan Posts: 61,453Questions: 1Answers: 10,055 Site admin

    No - it should be quite possible to include hidden, visible and anything inbetween. The example Kevin linked to shows the Excel button being used to export visible columns only. Change the column visibility using the Column visibility button and then click export to see that effect.

    Allan

  • abh555abh555 Posts: 6Questions: 2Answers: 0

    I must have had something else wrong when I tried this last night, it's working fine this morning. :) Thanks very much for your help!

This discussion has been closed.