Add a line like this in the $tableColumns definition:
- Code: Select all
'table_fun' => array(&$this,'setColor'),
Then place this function OUTSIDE of the initiateEditor() function:
- Code: Select all
function setColor($col,$val,$row,$instanceName,$rowNum)
{
$html = $val;
if ($val < 0)
{
$html = '<div style="background-color:red;">'.$val.'</div>';
}
return $html;
}
Unfortunately, the div only colors the full lineheight of the text. It does not completely fill the cell if the row has been stretched taller because of other data cells. Is there any way to affect the css of the parent <td> or higher?