Each table row have different colors

Each table row have different colors

iammohan83iammohan83 Posts: 1Questions: 0Answers: 0
edited January 2012 in DataTables 1.8
I have requirement to display each row in a different color. For ex: if the data set has 20 records. The 20 Records to be displayed in different color. Please any one help me.....

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Couple of options - the first is to simply loop over all rows in the table (table.fnGetNodes, or table.$('tr') in 1.9) and apply whatever class / colour you want.

    Or you could prebuild http://datatables.net/usage/options#asStripClasses if you know the number of rows before your initialise the table.

    Allan
This discussion has been closed.