My table contains more than 30 columns. I am using the datatable-JQuery and I have CSV button and PDF button for report download. I can't change page size while exporting PDF file.(When i am clicking the PDF button) . The downloaded PDF file contain half table data.
Please suggest any idea to export full table data. Thanks!
$(document).ready(function() {
$('#example').DataTable( {
dom: 'Bfrtip',
buttons: [
{
extend: 'csv',
title: 'TIC TICKET REPORT',
exportOptions: {
columns: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29]
}
},
{
extend: 'pdfHtml5',
orientation: 'landscape',
pageSize: 'LEGAL',
title: 'TIC TICKET REPORT',
exportOptions: {
columns: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29]
}
}
],
"aoColumnDefs": [{
"bSortable": false,
"aTargets": []
}],
initComplete: function () {
this.api().columns([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29]).every( function () {
var column = this;
var select = $('<select><option value="">Select</option></select>')
.appendTo( $(column.footer()).empty() )
.on( 'change', function () {
var val = $.fn.dataTable.util.escapeRegex(
$(this).val()
);
column
.search( val ? '^'+val+'$' : '', true, false )
.draw();
} );
column.data().unique().sort().each( function ( d, j ) {
select.append( '<option value="'+d+'">'+d+'</option>' )
} );
} );
}
} );
} );