Я использую настраиваемые поля выбора фильтров в моих таблицах данных и пытаюсь реализовать кнопки экспорта.Тем не менее, я получаю от выбора, отображаемого в качестве заголовка на экспорт.я хочу удалить выпадающий фильтр выбрать значения из заголовка при экспорте в Excel pdf или распечатать вот мой код я также прилагаю скриншот вывода Код, который я использую для создания фильтра выбора:
В приложенииснимок экрана
$(document).ready(function() {
$('#invoicetable').DataTable( {
dom: 'lBfrtip',
buttons: [
{ extend: 'print', filename: 'Pay Summary',title: 'Pay Summary',footer: true },
{ extend: 'excelHtml5', filename: 'Pay Summary',title: 'Pay Summary',footer: true },
{ extend: 'pdfHtml5', filename: 'Pay Summary', title: 'Pay Summary', footer: true },
],
initComplete: function () {
this.api().columns([0,2]).every( function () {
var column = this;
var select = $('<select><option value=""></option></select>')
.appendTo( $(column.header()).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>' )
} );
} );
},
"footerCallback": function ( row, data, start, end, display ) {
var totapi = this.api(), data;
// Remove the formatting to get integer data for summation
var intVal = function ( i ) {
return typeof i === 'string' ?
i.replace(/[\$,]/g, '')*1 :
typeof i === 'number' ?
i : 0;
};
pageTotal = totapi
.column( 3, { page: 'current'} )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
saltot = totapi
.column( 5, { page: 'current'} )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
dectot = totapi
.column( 6, { page: 'current'} )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
salpay = totapi
.column( 7, { page: 'current'} )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
// Update footer
$( totapi.column( 3 ).footer() ).html(pageTotal);
$( totapi.column( 5 ).footer() ).html(saltot);
$( totapi.column( 6 ).footer() ).html(dectot);
$( totapi.column( 7 ).footer() ).html(salpay);
}
} );
} );