I have a field nzqaid that needs to hold 1 decimal place, so is a float(6,1) in the database.
If the decimal place is 0, I don't want it to show in the record listing (ie: 8.1 is fine, but 8.0 needs to show as 8).
I can manipulate the field itself using a load_callback to the function below, so its value shows as 8
However, the record is still listed as 8.0, so I think I must use a label_callback to change this.Code://nzqaid field load_callback..... round the nzqaid (cut off .0 if it exists) public function nzqaidRound($varValue) { $varValue = round($varValue,1); return $varValue; }
The current label is
I'm not sure what gets passed to and from the label_callback, and I can't find much documentation.Code:'label' => array ( 'fields' => array('name','nzqaid','attention'), 'format' => '%s <span style="color:#b3b3b3; padding-left:3px;">[%s]</span><span style="color:#ff0000; padding-left:6px;">[%s]</span>' ),
Can anyone help me with the function code to round nzqaid in the label_callback?


Reply With Quote
Bookmarks