Button styles are incorrect.
Button styles are incorrect.
jbnv
Posts: 9Questions: 4Answers: 1
Here's the HTML for the Copy button from the Button Styles: Bootstrap 5 page:
<button class="btn btn-secondary buttons-copy buttons-html5" tabindex="0" aria-controls="example" type="button"><span>Copy</span></button>
Here's the HTML I'm getting for my Copy button:
<button class="dt-button buttons-copy buttons-html5" tabindex="0" aria-controls="employers_table" type="button"><span>Copy</span></button>
So clearly the problem is that I'm getting the dt-button
class instead of the btn
and btn-secondary
classes. What's the problem and how do I resolve it?
Answers
Sounds like you need to use the Download Builder to get the correct style integration files for Bootstrap 5.
If this doesn't help please post a link to your page or a test case replciating the issue so we can help debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
I did in fact use the Download Builder to get the links to the style integration files. Here are the ones specificly for DataTables currently in my project:
https://cdn.datatables.net/1.13.1/css/dataTables.bootstrap5.min.css
https://cdn.datatables.net/buttons/2.3.2/css/buttons.bootstrap5.min.css
https://cdn.datatables.net/fixedheader/3.2.4/css/fixedHeader.bootstrap5.min.css
https://cdn.datatables.net/searchpanes/2.0.2/css/searchPanes.bootstrap5.min.css
https://cdn.datatables.net/select/1.4.0/css/select.bootstrap5.min.css
https://cdn.datatables.net/staterestore/1.1.1/css/stateRestore.bootstrap5.min.css
As for a live test case, I'll have to see what I can put together. The project itself is not accessible to the public.
Update:
Here are the dependencies in my package.json:
My JavaScript file looks like this:
I'm getting this error in the console:
The error occurs here:
Fixed the issue by removing
DataTables(window, $);
andbuttons(window, $);
.Sounds like you might be using Vite, ESBuilder or similar for your Javascript bundle. This part of the 1.13 release blog post explains why you might be finding a change.
I'm going to get the docs updated for that very shortly.
Allan