Contoh Datatable Export Excel dan Filter Field
<script>
$(function() {
$("#example1").DataTable({
"responsive": true,
"lengthChange": false,
"autoWidth": false,
"buttons": [{
extend: 'excel',
text: 'Download Excel',
filename: 'example1_data'
}, {
text: 'Filter KRS Status',
action: function(e, dt, node, config) {
var krsStatusFilter = $('<select id="krs-status-filter"><option value="">All</option><option value="Already">Already</option><option value="Not Yet">Not Yet</option></select>');
krsStatusFilter.appendTo(node);
krsStatusFilter.on('change', function() {
dt.column(2).search(this.value).draw();
});
}
}]
}).buttons().container().appendTo('#example1_wrapper.col-md-6:eq(0)');
$('#example2').DataTable({
"paging": true,
"lengthChange": false,
"searching": false,
"ordering": true,
"info": true,
"autoWidth": false,
"responsive": true,
});
});
</script>
Lanjut Part : 1
Muhammad Ullil Fahri
WA : 089696380422
Tautan WA : https://wa.me/message/SG4YA2XQP5FPE1