change the column BG color depending on the
change the column BG color depending on the
jyothisrinivas
Posts: 3Questions: 0Answers: 0
Hi,
I have been using datatables, its amazing and wonderful. I have been struck with one of the problem. On the datatables, I have 7 columns. These 7 columns have background color changes depending on the server data. I need to change the background color for the corresponding . Could you please help me on this? I guess i need to use fnheadercallback. But need to know how to capture and get the backgroundcolor for the cells.
Thanks and regards,
Jyothi
I have been using datatables, its amazing and wonderful. I have been struck with one of the problem. On the datatables, I have 7 columns. These 7 columns have background color changes depending on the server data. I need to change the background color for the corresponding . Could you please help me on this? I guess i need to use fnheadercallback. But need to know how to capture and get the backgroundcolor for the cells.
Thanks and regards,
Jyothi
This discussion has been closed.
Replies
Header 1
Header 2
row 1, cell 1
row 1, cell 2
row 2, cell 1
row 2, cell 2
function assigncolr(col, index) {
$('#one tbody tr').each(function() {
$(this).find('td:nth-child(' + (index + 1) + ')').css("background-color", col);
});
}
$(document).ready(function() {
$('#one thead tr th').each(function() {
var col1 = $(this).css("background-color");
var index = $(this).closest("th").prevAll("th").length;
assigncolr(col1, index);
});
});