In the tablename_init hook, I have my workorders.status text changing color based on what the data is (if workorder.status = "Complete", font-color="red"). I also have a location table, and related child workorder records are displayed under each location record. When viewing the workorder records as children, the color does not take effect.
Examples-
Working in TV:
Not working as child ("New" should be green):
Here is the code I'm using in hooks/workorders.php:
Code: Select all
function workorders_init(&$options, $memberInfo, &$args){
$oldArray=$options->QueryFieldsTV;
$options->QueryFieldsTV='';
foreach($oldArray as $field => $caption){
if($field=='`workorders`.`status`'){
$options->QueryFieldsTV['IF(`workorders`.`status`=\'New\', \'<b style="color: green;">New</b>\', IF(`workorders`.`status`=\'Complete\', \'<b style="color: red;">Complete!</b>\', `workorders`.`status`))']=$caption;
}
else
{
$options->QueryFieldsTV[$field]=$caption;
}
}