How to toggle the export (print, excel, etc) of a column.

How to toggle the export (print, excel, etc) of a column.

GlyndwrGlyndwr Posts: 128Questions: 35Answers: 1

I am toggling the visibility of a column and would also like to toggle the export (print, excel, etc) as well (i.e. only export when visible). Can someone please show me how to do this?

    // Get the column API object
    var column = patrolUpdateTable.column(4);

    // Toggle the visibility
    column.visible( ! column.visible() );

I can not simply print if visible as there is a column containing images that is visible and I am not exporting.

{extend: 'copy',
           exportOptions: {
             columns: [ 2, 3 ]
           }
},

Kind regards,

Glyn

Answers

  • kthorngrenkthorngren Posts: 21,143Questions: 26Answers: 4,918
  • GlyndwrGlyndwr Posts: 128Questions: 35Answers: 1

    Hi Kevin,

    Thanks for your help. I have seen this what I need is something like:

    // Toggle the visibility
    column.visible( ! column.visible() );
    //Toggle the export
    column.export( ! column.export() ); // of course this does not work, it is an example
    

    I can not find the correct command to toggle the export (print, excel, etc).

    Kind regards,

    Glyn

This discussion has been closed.