Server-Side Processing, Cell-Specific CSS

Server-Side Processing, Cell-Specific CSS

BendettaBendetta Posts: 2Questions: 0Answers: 0
edited January 2012 in General
I'm loading my data table server-side, and I need to flag specific values. I see that you can set the row css in the returned aaData, but I'm having trouble finding anything about css for a specific cell. Is it possible to do it from the server? Otherwise, I'm going to need some ugly javascript.

Replies

  • BendettaBendetta Posts: 2Questions: 0Answers: 0
    Nevermind - I figured it out. I discovered http://www.datatables.net/ref#fnRowCallback and ported my css-determining code to there. So it looked something like
    [code]
    "fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
    ColorCells(nRow,aData);
    return nRow;
    }

    function ColorCells(nRow,aData){
    var cell = nRow.cells[14];
    var cellValue = aData[14];

    if (cellValue > 10)
    $(cell).addClass('good');
    else if (cellValue === 0)
    $(cell).addClass('warning');
    }
    [/code]
This discussion has been closed.