fnDrawCallback, add classes according to values

fnDrawCallback, add classes according to values

andrew1986andrew1986 Posts: 12Questions: 5Answers: 0
edited April 2014 in General
Hi again guys,

I just wonder is possible to add a class to a tr, base on a td value? meaning, if my td is X, add a class to a parent tr...

Any advises?

Thanks in advanced.

Replies

  • andrew1986andrew1986 Posts: 12Questions: 5Answers: 0
    NVM, I found the solution,

    fnDrawCallback': function(){

    $('td.status').each(function(){
    if ($(this).text() == "STATUS") {
    $(this).parent().addClass("the_class");
    }
    })
    }
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    fnCreatedRow is how I would recommend doing it. It is more efficient than fnDrawCallback since it only runs once.

    Allan
This discussion has been closed.