-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Datatables 2.0 does not consider BS5 table variants #11
Comments
Hi - thanks for letting me know about this. I'll look and see if I can make better use of the Bootstrap variables to address this when I get a chance. |
I noticed the same bug, that prevents any background-color in cells when importing file https://cdn.datatables.net/2.0.2/css/dataTables.bootstrap5.css I think the culprit is the following line:
When I disable it, background colors in bootstrap5 tables work fine. I don't know why this line has been added, but it wasn't in versions 1.13, when the bug was not present. |
Its there because the row tinting for stripes in Bootstrap is done with the background colour. However, in DataTables, to make row background colours easier (in everything apart from Bootstrap apparently :)) I tint it using a box shadow, So if you applied "red" as the background colour, you still can have row striping without worrying about the tint yourself. Hence the need for the transparent override. That obviously doesn't work with Bootstrap coloured tables - hopefully there are some Bootstrap CSS variables for this that will let me address the issue. |
I was about to create a similar issue. When using Datatables bs5, I expect our datatables to inherit the colors and design from Bootstrap 5. Unfortunately, this package override the design of tables trying to mimic Bootstrap 5 instead of adding Bootstrap 5 classes to the Bootstrap 5 already supports colors for hover, striped, selected... rows and the library should simply apply the corresponding CSS classes to the table/rows/cells instead of trying to mimic Bootstrap design. |
Yup, I need to use CSS variables more - a PR to the source repo would be welcomed. The selected row is an exception - I've used a box shadow as described above to allow background colour for the rows to be set as well. |
I experimented a bit with Datatables 2.0 and various Bootstrap 5 Table variants (i.e. table header different color than table body). It seems that class
dataTables
which is inserted by datatables.js overrides most Bootstrap 5 classes (i.e.table-dark
does have white text, but not black background).Example:
The text was updated successfully, but these errors were encountered: