DataTables / DataTablesSrc

DataTables source repository
https://datatables.net
MIT License
587 stars 422 forks source link

2.0.0 broke coloring bootstrap 5 tables using table-{color} #262

Closed yankarinRG closed 1 month ago

yankarinRG commented 4 months ago

This commit https://github.com/DataTables/DataTablesSrc/commit/024c49bc2f5130460bb939af17191b7b721b6cf4 prevents bootstrap's table-{color} from having effect to color tables, table rows or individual cells.

Working example (pre 2.0.0): https://live.datatables.net/golivuru/1/edit Broken example (as of 2.0.0 with that commit): https://live.datatables.net/sayanoxa/1/edit

AllanJard commented 4 months ago

Thanks for posting this. I'll try to look into this and see what options I have to address it in the next few weeks.

yankarinRG commented 4 months ago

Thank you Allan for the short reply and for taking the time to fix this issue. Also, I'd like to take a moment to drop a quick note to express my gratitude for your amazing work on the DataTables library.

For those encountering this coloring issue, I've found a workaround that might help in the interim until the main fix is implemented.

Instead of using table-danger, try applying the following code snippet:

row.classList.add("border-danger-subtle");
cells.forEach(cell => cell.classList.add("bg-danger-subtle", "text-danger-emphasis"));

This workaround not only addresses the color inconsistency but also ensures adaptability with dark mode. Hope this helps! 🚀

AllanJard commented 1 month ago

I forgot to update this issue - apologies. The error was fixed around 2.04 ish. With the current 2.0.7 it works as expected: https://live.datatables.net/hevogiko/1/edit . I've also just committed a fix to FixedColumns for a related issue (which is what reminded me about this issue).