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_GR_G Posts: 31Questions: 10Answers: 0

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;
}
Sign In or Register to comment.