Background color to child rows
Background color to child rows
Tdazle007
Posts: 8Questions: 2Answers: 0
Hello guys, please how do you add background color to child rows of datatables. Here is a test case.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
If you want a flat colour you can do this...
Or if you want the rows to alternate odd/even then you can do this...
http://live.datatables.net/qeweyiji/5/edit
Thanks so much for your response. What i was looking for was in such a way that i give an ID to a particular <th> or <td> and the <th> or <td> inherits the background set in the css. Is that possible?
You can give a class
columns.className
to columns but I'm not sure they would work once in the child row. You can add styles to the child rows in the js like in this...This is how I managed it in my case. Although I used
class
and notid
because I applied styles to multiple<td>
. If this doesn't help in your case I think someone else will need to help you.Have you looked at this example?
https://datatables.net/examples/api/row_details.html
This is what my version is based on.
Thank you so much. Let me try this. Once it works I'll give you a feedback.
Thank you silkspin. It worked!