PHP Classes

Custom Format a Column

Recommend this page to a friend!

      Eyesis Data Grid Control  >  All threads  >  Custom Format a Column  >  (Un) Subscribe thread alerts  
Subject:Custom Format a Column
Summary:Custom format a column not working
Date:2011-07-07 03:28:45

  1. Custom Format a Column   Reply   Report abuse  
Picture of ZZorro 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)
$x->setColumnType('brand', EyeDataGrid::TYPE_FUNCTION, 'returnSomething', '%brand%');

Can anyone help me to get these two custom formats to work?