how to Omit One specific column from visible columns in export options

how to Omit One specific column from visible columns in export options

invincibleinvincible Posts: 1Questions: 1Answers: 0
buttons: [ 
                        { extend: 'print', exportOptions: { columns: ':visible'}},
                        { extend: 'copy', exportOptions: { columns: ':visible'}},
                        { extend: 'pdf', exportOptions: { columns: ':visible'}},
                        { extend: 'excel', exportOptions: { columns: ':visible'}},
                        ]

This is my exports Buttons code, i want to omit one specific column from visible columns. Can anybody know how to do it ???/

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,822Questions: 1Answers: 10,127 Site admin

    The columns option is inclusive. There is no exclude option. You would have to use the columns option to list the columns that you want to be able to export, or perhaps add a class to the columns you want to be able to export so you can address them with a simple class.

    Allan

  • rubjorubjo Posts: 5Questions: 1Answers: 1

    Should it be possible to do

                exportOptions: {
                  columns: '.exportable:visible'
                }
    

    ?

    This doesn't work for me. I'll use a function for columns instead.

  • rubjorubjo Posts: 5Questions: 1Answers: 1
    Answer ✓

    Sorry, just found

    https://datatables.net/forums/discussion/comment/101912/#Comment_101912

    exportOptions: {
      columns: ':visible.exportable'
    }
    

    works.

    :smile:

This discussion has been closed.