I am using Data table with Button. I want to show Success button rather default. I tried this Code
buttons: [
{
extend: \"excel\",
className: \"btn-sm btn-su
Yes, this can be really annoying. It is the same without using bootstrap, where .dt-button always is added even if you declare className. There is a init callback you can use to modify for example classes :
$('#example').DataTable( {
dom: 'Bfrtip',
buttons: [{
extend: "excel",
className: "btn-sm btn-success",
titleAttr: 'Export in Excel',
text: 'Excel',
init: function(api, node, config) {
$(node).removeClass('btn-default')
}
}]
});
demo -> https://jsfiddle.net/m6hysypd/
Update: Have received a lot of upvotes on this, but the correct or best answer is actually "DavidDomains"'s answer below. Use
buttons: {
dom: {
button: {
className: ''
}
},
buttons: [{
//here comes your button definitions
}]
}