How to change buttons style (Bootstrap 4) for buttons outsides of "buttons" option
How to change buttons style (Bootstrap 4) for buttons outsides of "buttons" option

Link to test case: https://live.datatables.net/mohuvuji/1/edit
Debugger code (debug.datatables.net): NA
Error messages shown: NA
Description of problem: Hello,
I wanted to know if it was possible to change the style of a button (Bootstrap 4) for buttons that are not part of the default "buttons" group as can be done via the "dom" option.
I have seen this answer https://datatables.net/forums/discussion/comment/193757/#Comment_193757 and it works.
// Works if I uncomment this line
//DataTable.Buttons.defaults.dom.button.className = 'btn';
But I prefer to do it from configuration if possible.
Also, if you have a look to the test case, you can see that searchBuilder button is cut on the right you you click on it.
Is this normal or is it a small aesthetic bug?
It misses the rounding border.
This question has an accepted answers - jump to answer
Answers
Looks like
btn-secondary
is added to that button. One option is to useready()
to removebtn-secondary
from the button:https://live.datatables.net/mohuvuji/2/edit
Kevin
Hello @kthorngren,
Thanks for your answer.
It works but it is not a nice solution (it makes the button flashing).
I think it could be nicer to have a way to do it like the "dom" option for "buttons".
You've already got the answer in your example I think
. You use:
Just do the same for the second instance:
I think setting the default is a nicer way of doing it if you are going to need that for all of the instances on the page, but that's how it is done.
The key thing to know here is that:
is just short hand for:
Allan
Hi @allan,
Thanks a lot for your answer.
I did what you told me like below and it works like a charm
DataTables component is so customisable that is sometime a bit quite hard to find the way to do what we need.
But there is almost always a way to do what you want and that's great!
But I'm glad to know the other possibility.
Yeah - there are a ton of options! I frequently use the docs to check the methods and options myself as well
Allan