Styling cells based on value
Styling cells based on value
neburton
Posts: 63Questions: 6Answers: 0
Previously I have applied styles to individual cells based on their content during the fnRowCallback utilising the fnGetTds plugin.
"fnRowCallback": function( nRow, aData, iDisplayIndex )
{
var value= aData[0];
if (value=='1')
{
$(this.fnGetTds(nRow)[5]).addClass('ui-state-error');
}
return nRow;
}
I was using fnGetTds rather than a standard jQuery selector, as the first column was hidden.
I cannot figure out how to achieve this with DataTables 1.10 and the new API. I've been reading up on .cell()
and .cells()
but not getting very far. as there are few examples in the reference at present.
This discussion has been closed.
Answers
Managed to figure this out myself.
The
columns.createdCell
option is another option.Allan