I want to add custom button in a column called "view services" because I want to display multiple values in that column. How can I add a custom button with custom content to perform a custom function? When user click that button I want to open a bootstrap modal to view the multiple values. How can I do this? I'm new to using datatables.
my code:
$('#appointment-datatable').DataTable({
processing: true,
serverSide: true,
ajax: '/get_appointment_data',
columns: [
{ data: 'id', name: 'id' },
{ data: 'user_type', name: 'user_type' },
{ data: 'firstname', name: 'firstname' },
{ data: 'lastname', name: 'lastname' },
{ data: 'vehiclemodel', name: 'vehiclemodel' },
{ data: 'date', name: 'date' },
{ data: 'time', name: 'time' },
{ data: 'payment_status', name: 'payment_status' },
{ data: 'amount', name: 'amount' },
{ data: null, render: function(data, type, full, meta) {
return '<button class="btn btn-mini btn-primary pull-right"> View Service</button>';
} }
],
dom: 'Bfrtip',
buttons: [
{ extend: 'print' },
{ extend: 'pdf' },
{ extend: 'excel' }
],
});