I am using datatables plugin for by displaying data in my html page. I have a requirement where I want to export the data inside the datatable.
Datatable supports this functionality by some plugins and a example can be seen here.
what I get on screen is that the export buttons with the fixed default names like below

I want to change the default names to custom names. eg. "Excel" to "Export to Excel"
How can I do that?
$(document).ready(function() {
$('#example').DataTable( {
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
} );
} );
In the above code if I change the default names , then my functionality breaks because datatable recognizes the functionality of button by its name. Is there any property which I should use which will help me achieve what I want or any other way out?
With the new version of DataTables;
buttons: [
{
extend: 'copy',
text: 'Copy to clipboard'
}
]
Here is the example from documentation.
You can try this:
buttons: [
{
sExtends: 'copy',
text: 'Custom text'
}
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With