Set background color based on value in other cell

Set background color based on value in other cell

MirrhMirrh Posts: 2Questions: 0Answers: 0
edited July 2013 in DataTables 1.9
Hi,

I really love this DataTables,

Please help me. How to set background color based on value of other cell?

[code]
"aoColumnDefs": [
{
"aTargets":[2],
"fnCreatedCell": function(nTd, sData, oData, iRow, iCol)
{
if(sData == 'Value')
{
// How to set background color of other cell like
// "aTargets":[1] $(nTd).css('background-color', 'blue');
$(nTd).css('background-color', 'blue');
}

},
}
]
[/code]

Thank you in advance

Replies

  • MirrhMirrh Posts: 2Questions: 0Answers: 0
    edited August 2013
    Hi,

    I found the way as below,

    [code]
    "aoColumnDefs": [
    {
    "aTargets": [2],
    "fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {

    var lociMatch = oData[21];
    if (lociMatch[1] == "1") {
    $(nTd).css('background-color', '#FFFACD');
    }
    }
    }]
    [/code]

    I just want to thank you Allan and people who made this wonderful tool.

    Thank you.
This discussion has been closed.