dataTable: make odd column different color from even column

dataTable: make odd column different color from even column

jinghanjinghan Posts: 2Questions: 0Answers: 0
edited February 2014 in General
Hi Allan,

I have a dataTable with several column, I'd like odd columns have different color from even columns.
Does dataTable have an option for this? or Is there a way to achieve this? (I think I don't need to provide a test case for this question.)

Any help would be appreciated.

jing

Replies

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    https://datatables.net/usage/columns
    Use sClass to apply CSS classes to columns.
  • jinghanjinghan Posts: 2Questions: 0Answers: 0
    Thank you, tangerine, css works.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Best way for this is probably to use CSS's `:nth-child` selector with the odd and even options: https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child

    Allan
This discussion has been closed.