fnCreatedCell to mRender

fnCreatedCell to mRender

sdinesh21sdinesh21 Posts: 37Questions: 0Answers: 0
edited September 2013 in DataTables 1.9
Hi,

I am using the fnCreatedCell to format my cell value based on JSON data for that column. How do I rewrite this using mRender? Is it more efficient (memory wise) using mRender?
[code]
{ "sTitle": "Severity", "bVisible": true, "mData" : "5", "sWidth": "10%", "bSortable": true,
"fnCreatedCell": function(nTd, sData, oData, iRow, iCol)
{
switch(sData)
{
case 1:
$(nTd).addClass('alertSeverityLow');
$(nTd).text("Low");
break;
case 2:
$(nTd).addClass('alertSeverityMedium');
$(nTd).text("Medium");
break;
case 3:
$(nTd).addClass('alertSeverityHigh');
$(nTd).text("High");
break;
case 4:
$(nTd).addClass('alertSeverityCritical');
$(nTd).text("Critical");
break;
}
}
}
[/code]

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    You can't rewrite that in mRender since mRender can't effect the cell class, as you are currently using.

    Allan
  • sdinesh21sdinesh21 Posts: 37Questions: 0Answers: 0
    Ok, thanks Allan! Appreciate your quick response.
This discussion has been closed.