Individual cell formating
Archived from the Xataface Users forum.
Gwynnbleid1 — Mon Oct 22, 2012 12:43 am
Hi.
Is it possible to format single cell (like change font color) ? I found this funciton css__tableRowClass and also this http://xataface.com/wiki/Customizing_th … _or_a_cell but I couldn’t find example for single cell situation.
Please help !
silma — Mon Oct 22, 2012 1:59 am
Look for the “renderCell “ section there :
http://xataface.com/documentation/how-to/list_tab
Gwynnbleid1 — Mon Oct 22, 2012 2:54 am
silma wrote:Look for the “renderCell “ section there :
http://xataface.com/documentation/how-to/list_tab
Thanks for suggestion. I ended with something like this:
- Code: Select all
function SuspensionWear__renderCell(&$record) { if ( $record->val('SuspensionWear2') == 99 ) return '<div style="color:red;font-weight:bold;display: table-cell;">'.$record->strval('SuspensionWear').'</div>'; else return $record->strval('SuspensionWear'); }
It works well but I need to add red font color for some other fields, so function above is repeated several times for other fields. Is it possible to add a function like this :
- Code: Select all
static function GedRedVal($val) { return '<div style="color:red;font-weight:bold;display: table-cell;">'.$val.'</div>'; }
and use it in function renderCell ? I tried it but received an error.
silma — Tue Oct 23, 2012 12:22 am
What about a css class ?
For a rendering, it would be more adequate than a function.