I think this question is entry level. I used the following code to initialize a CGridView
The result of this code
is that 45.04 becomes 45.
If I want to keep 2 digits behind 0, how should I do it?
The CFormatter document seems irrelevant to this issue, or I couldn’t figure it out by reading all the CGridView document.
How about this?
return number_format($data->totaldue, 2);
This totally helped me!! Thanks:3 Good vibes.
Thank you! This totally helped! Though for future reference - what does function($data) do exactly?
It’s an anonymous function that runs once for each row. $data is the model record for the current row.