Reputation:
I have values that are stored in raw number form percents (e.g .998) in my generated models.
However, for my views, as well as display in CGRIDview I would like these data points to be multiplied by 100, but retain the same value in the backend database. So in my view the above example should display as 99.8 %
Upvotes: 2
Views: 438
Reputation: 586
Define your CGridView columns the following method:
'columns' => array(
// ... fields
array(
'name' => 'fieldWithPecent',
'value' => 'sprintf("%3.1f%%", $data->fieldWithPecent * 100)',
),
// other fields definition
),
Upvotes: 1