Exclude column from export by using html5 buttons
Exclude column from export by using html5 buttons
DannyDeVito
Posts: 1Questions: 0Answers: 0
I am trying to exclude last column from pdf/excel/csv export and for real i cant find a solution...
This discussion has been closed.
Replies
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();
}
},
See this example for how to select which columns will be included in the output.
Allan