Page 1 of 1

Individual cell formating

PostPosted: Mon Oct 22, 2012 12:43 am
by Gwynnbleid1
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 !

Re: Individual cell formating

PostPosted: Mon Oct 22, 2012 1:59 am
by silma
Look for the "renderCell " section there :
http://xataface.com/documentation/how-to/list_tab

Re: Individual cell formating

PostPosted: Mon Oct 22, 2012 2:54 am
by Gwynnbleid1
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.

Re: Individual cell formating

PostPosted: Tue Oct 23, 2012 12:22 am
by silma
What about a css class ?
For a rendering, it would be more adequate than a function.