Adding attributes to the export buttons
Adding attributes to the export buttons
jLinux
Posts: 981Questions: 73Answers: 75
I was wondering if it was possible to add any attributes to the a tag that is generated by the buttons.
I know you can specify the className, but I wanted to add a title attribute. Currently, what I do is add a class to the button, then after the buttons are added, use jQueries $().attr() functionality to add the title to the link generated by buttons, its rather unorthodox, but it works.. I was hoping that there was a way to do it via DataTables.
Heres the code I have to do it right now.
// Configure Export Button
new $.fn.dataTable.Buttons( $assets_dt, {
buttons: [
{
text: '<i class="fa fa-lg fa-clipboard"></i>',
extend: 'copy',
className: 'export-copy ttip'
}
]
} );
// Add the Export buttons to the toolbox
$assets_dt.buttons( 0, null ).container().appendTo( '#export-assets' );
// Add the tooltip
$('a.assets-export-btn.export-copy').attr('title', 'Export to clipboard');
Thanks!