Looking to export data to Excel? Check out the code snippet below.
$('#tabelku').dataTable({
dom: 'Bfrtip',
"buttons": [{
extend: 'excel',
text: 'Excel'
}
],
dom: '<"row"<"col-lg-6"l><"col-lg-6"f>><"table-responsive"t>p',
"aLengthMenu": [
[10, 20, 30, 40, -1],
[10, 20, 30, 40, "All"] // adjust page values here
],
"bProcessing": true,
"bServerSide": true,
"sServerMethod": "POST",
"bRetrieve": true,
"sAjaxSource": "<?= site_url() ?>monev/do_Tabel_Universitas",
// set initial value
"iDisplayLength": 10,
"oLanguage": {
"sProcessing": '<i class="fa fa-coffee"></i> Please wait...',
"sLengthMenu": "_MENU_ records",
"oPaginate": {
"sPrevious": "Prev",
"sNext": "Next"
}
},
"aoColumnDefs": [{
'bSortable': false,
'aTargets': [0, 8]
}
],
});
The Excel button is visible, but you're missing the dropdown for 10, 20, 30, and 40 records. This dropdown was showing before adding the following code:
dom: 'Bfrtip',
"buttons": [{
extend: 'excel',
text: 'Excel'
}
],
Any idea what code I might be overlooking?