Why the import button couldn't display after adding the serverSide:"true " and ajax things
Why the import button couldn't display after adding the serverSide:"true " and ajax things
DesmondYap1110
Posts: 1Questions: 1Answers: 0
$(function() {
'use strict'
var table = $('#exportexample').DataTable({
buttons: [ 'copy', 'excel', 'pdf', 'colvis' ],
language: {
searchPlaceholder: 'Search',
sSearch: '',
lengthMenu: '_MENU_',
},
"order": [ [0, "asc"] ],
"pageLength": 10,
'serverMethod': 'post',
"pagination": true,
"info": true,
scrollCollapse: true,
"processing": true,
"serverSide": true,
'ajax':
{
url : "member.ajax.php", // json datasource
data:
{
//"ref1": rel1
},
type : "post"
},
"columns":
[
{ data: 'ID' },
{ data: 'register_date' },
{ data: 'name' },
{ data: 'nric' },
{ data: 'hp' },
{ data: 'latest_point' },
{ data: 'status' },
{ data: 'action' }
],
columnDefs:
[
{ className: 'text-center', targets: [0,1,3,4,5,6,7]},
{ "bSortable": false, "aTargets": [3,4,6,7] }
]
});
//Button
table.buttons().container().appendTo( '#exportexample_wrapper .col-md-6:eq(0)' );
});
Answers
There are no obvious issues looking at your code. Take a look at the browser's console for errors. Let us know what you find.
Kevin