Datatables 2.0.0 "stripeClasses" removal

Datatables 2.0.0 "stripeClasses" removal

krutovdlkrutovdl Posts: 36Questions: 7Answers: 1
edited February 26 in DataTables

Since the "stripeClasses" was removed from the new Datatables version, what is now the proper way to capture every odd and even row in order to changes their background color? Please provide examples.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,970Questions: 1Answers: 10,160 Site admin
  • krutovdlkrutovdl Posts: 36Questions: 7Answers: 1

    This is the old code:

    tr.odd {
    --bs-table-bg: lightcyan;
    }

    tr.even {
    --bs-table-bg: #c5fbfb;
    }

    Here is the new code:

    -tbody->-tr:nth-child(2n+1)-{">-tbody->-tr:nth-child(2n+1)-{">tbl > tbody > tr:nth-child(2n+1) {

    --bs-table-bg: lightcyan;
    

    }

    -tbody->-tr:nth-child(2n)-{">-tbody->-tr:nth-child(2n)-{">tbl > tbody > tr:nth-child(2n) {

    --bs-table-bg: #c5fbfb;
    

    }

    This worked well except now the column widths are no longer behaving properly. Now all columns set to "visible: false" are indeed not visible but they are taking up the column width on the table. Which creates an appearance of the visible columns width being cut in half.

  • krutovdlkrutovdl Posts: 36Questions: 7Answers: 1
    Answer ✓

    Please disregard the latter comments. The issue table with issue was fixed after stopping and restarting the debug session. Please close this discussion. Thank you.

This discussion has been closed.