Quantcast
Channel: ColVis — DataTables forums
Viewing all articles
Browse latest Browse all 77

Update column for print when using colvis

$
0
0

Hello,

I am using Colvis to show and hide columns, it works well but when I want to print or export the datable the columns are not updated.

I have tried to add a variable at the beginning of my code and do something like that :

$('#datatables-buttons').on( 'column-visibility.dt', function ( e, settings, column, state ) {
            $('#datatables-buttons').DataTable().columns().every( function () {
                if (this.visible()) {
                    columns_export.push(this.index());
                }
            } );
            console.log(columns_export);
        } );

But it does not work and I imagine there is something cleaner or out of the box.

Thank you !


Viewing all articles
Browse latest Browse all 77

Trending Articles