will this work--- "mColumns": [ "hidden",1,2,3,4 ],

will this work--- "mColumns": [ "hidden",1,2,3,4 ],

sanjkumc3sanjkumc3 Posts: 3Questions: 1Answers: 0

How to get hidden column in export pdf in TableTools

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
  • sanjkumc3sanjkumc3 Posts: 3Questions: 1Answers: 0
    $(document).ready(function() { var table = $('#software_table').DataTable({ 'sPaginationType': 'full_numbers', 'sDom': '<"dataTables_header"lfr>t<"dataTables_footer"ip>', 'aaSorting': [[ 4, "asc" ]], "columnDefs": [ { "visible": false, "targets": 0 } ], "order": [[ 0, 'asc' ]], "displayLength": 10, "drawCallback": function ( settings ) { var api = this.api(); var rows = api.rows( {page:'current'} ).nodes(); var last=null; api.column(0, {page:'current'} ).data().each( function ( group, i ) { if ( last !== group ) { $(rows).eq( i ).before( ''+group+'' ); last = group; } } ); } } ); // Order by the grouping $('#software_table tbody').on( 'click', 'tr.group', function () { var currentOrder = table.order()[0]; if ( currentOrder[0] === 0 && currentOrder[1] === 'asc' ) { table.order( [ 0, 'desc' ] ).draw(); } else { table.order( [ 0, 'asc' ] ).draw(); } } ); ///TableTools var oTableTools = new TableTools( table, { "aButtons": [ "print", { "sExtends":"collection", "sButtonText": "Save", "sRowSelect": "multi", "aButtons": [ { "sExtends": "csv", "sFileName": "*.csv", "mColumns": [ 1,2,3,4 ], "bSelectedOnly": true }, { "sExtends": "xls", "sFileName": "*.xls", "mColumns": [ 1,2,3,4 ], "bSelectedOnly": true }, { "sExtends": "pdf", "sPdfSize": "A3", "mColumns": [ 0,1,2,3,4 ], "bSelectedOnly": true } ] } ], "sSwfPath": "swf/copy_csv_xls_pdf.swf" } ); $('#demo').before( oTableTools.dom.container ); } );

    I am using a column grouping for first column but not getting in export for TableTools can you help..

  • sanjkumc3sanjkumc3 Posts: 3Questions: 1Answers: 0

    I am using a column grouping for first column but not getting in export for TableTools can you help..

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    In TableTools, no that will not work.

    However, in the replacement for TableTools - Buttons, yes you can do something like that. See the pdf button type - specifically the exportOptions option (which in turn uses buttons.exportData()).

    Allan

This discussion has been closed.