aaData + CSS

aaData + CSS

selma128selma128 Posts: 3Questions: 0Answers: 0
edited November 2012 in General
Hi, after searching the documentatio I can´t find what I need. Does someone know if i can use aaData and apply to a specific td a css class?

I what to add some color rules to my data.
For example, if the value is unden 50 then background is red and text white.

Has some done this?

Replies

  • girishmrgirishmr Posts: 137Questions: 0Answers: 0
    Use aoColumnDefs.

    [code]
    "aoColumnDefs": [
    {
    "aTargets":[1],
    "fnCreatedCell": function(nTd, sData, oData, iRow, iCol)
    {
    if(sData < 50)
    {
    $(nTd).css('background-color', 'red');
    $(nTd).css('color', '#fff');
    }

    }
    }
    ]
    [/code]
  • selma128selma128 Posts: 3Questions: 0Answers: 0
    Thanks.
This discussion has been closed.