ZZorro - 2011-07-07 03:28:45
I am trying to format a number column so that all displayed values will have two decimal places. Some are whole numbers, others have one or two decimal places. The values for this column are stored as text in the database.
I have tried the following code but the table stops at the first row and column:
// Apply a function to a row
function format_number($load)
{
return (number_format (intval($load), 1)); // format weight to 2 decimal places);
}
$x->setColumnType('weight', EyeDataGrid::TYPE_FUNCTION, 'format_number', '%weight%');
I have also tried as a test to reverse the stings in another column but the table does not display.
// Apply a function to a row
function returnSomething($lastname)
{
strrev($lastname);
}
$x->setColumnType('brand', EyeDataGrid::TYPE_FUNCTION, 'returnSomething', '%brand%');
Can anyone help me to get these two custom formats to work?