Exclude column from export by using html5 buttons

Exclude column from export by using html5 buttons

DannyDeVitoDannyDeVito Posts: 1Questions: 0Answers: 0

I am trying to exclude last column from pdf/excel/csv export and for real i cant find a solution...

Replies

  • RashuRashu Posts: 1Questions: 0Answers: 0

    Hi,
    here is how I got it working in exports..

    buttons: [
    {
    extend: 'excelHtml5',
    text: '<i class="fa fa-file-excel-o"></i> Excel',
    titleAttr: 'Export to Excel',
    title: 'Insurance Companies',
    exportOptions: {
    columns: ':not(:last-child)',
    }
    },
    {
    extend: 'csvHtml5',
    text: '<i class="fa fa-file-text-o"></i> CSV',
    titleAttr: 'CSV',
    title: 'Insurance Companies',
    exportOptions: {
    columns: ':not(:last-child)',
    }
    },
    {
    extend: 'pdfHtml5',
    text: '<i class="fa fa-file-pdf-o"></i> PDF',
    titleAttr: 'PDF',
    title: 'Insurance Companies',
    exportOptions: {
    columns: ':not(:last-child)',
    },
    },
    {
    extend: 'print',
    exportOptions: {
    columns: ':visible'
    },
    customize: function(win) {
    $(win.document.body).find( 'table' ).find('td:last-child, th:last-child').remove();
    }
    },

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

    See this example for how to select which columns will be included in the output.

    Allan

This discussion has been closed.