Reputation: 5095
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?
Upvotes: 3
Views: 8133
Reputation: 4552
With the new version of DataTables;
buttons: [
{
extend: 'copy',
text: 'Copy to clipboard'
}
]
Here is the example from documentation.
Upvotes: 9
Reputation: 11750
You can try this:
buttons: [
{
sExtends: 'copy',
text: 'Custom text'
}
]
Upvotes: 1