changing css based on row data from another cell in the row.

changing css based on row data from another cell in the row.

trubeltrubel Posts: 1Questions: 1Answers: 0

HI I'm trying to change data in a row based on data from the cell next to it in the same row.

I have this code working in the current rendered view of the datatable but it does not redraw when more rows are selected and I can't figure out how to make it draw

$('#example tr').each(function ()
{
var col = $(this).prevAll().length;
var headerObj = $(this).parents('table').find('th').eq(col);
// A quick test!
var nxtValBlk;
var nxtValFox;

    $(this).find("td").each(function(){                 
    switch(table.column(this.cellIndex).title()) 
    {
        case "Browser":
            if(this.textContent == "Chrome 10"){
                nxtValBlk = 'yes'
            }
            if(this.textContent == "Firefox"){
                nxtValFox = 'yes'
            }                   
        break;
        case "OS":
        if (nxtValFox == 'yes'){
            $(this).css('backgroundColor', '#F60');
            $(this).css('color', '#FFF');   
        }
        if (nxtValBlk == 'yes'){
            $(this).css('backgroundColor', '#000');
            $(this).css('color', '#CCC');   
        }                   
        break;              
        case "Browser type":
            //code block
            //break;                
        default:
            //default code block
    }
    });                 
});     
This discussion has been closed.