How do I change background colors for odd/even rows using multi-select with Bootstrap V5?
How do I change background colors for odd/even rows using multi-select with Bootstrap V5?
![R_G](https://secure.gravatar.com/avatar/59fdc868797104789106d0f637568198/?default=https%3A%2F%2Fvanillicon.com%2F59fdc868797104789106d0f637568198_200.png&rating=g&size=120)
I just figured this out. It was working on Bootstrap V3 using standard definitions but failed under V5. I upgraded to V5 while migrating to Rails 7. I cannot say what specifically changed, but this works. Depending upon your needs, you might also include the .sorting_x classes (1...8). This gave me alternating stripes during selection of the rows:
// Row select highlighting odd/even rows
table.dataTable.stripe tbody tr.odd.selected,
table.dataTable.display tbody tr.odd.selected {
--dt-row-selected: #37edfa;
--bs-table-bg: #37edfa;
}
table.dataTable.stripe tbody tr.even.selected,
table.dataTable.display tbody tr.even.selected {
--dt-row-selected: #37faa9;
--bs-table-bg: #37faa9;
}