I need to limit the characters of the email addresses in the GridView (zii.widgets.grid.CGridView), but unsure as to which is more “Yii” and generally better… I whacked in SUBSTR which works fine, but that feels like a hack… and Yii’s AFTERFIND function feels like its wasting processor effort or somthing…
Which is better?
Is it better to limit the characters via the Model, or the View? See below
'columns'=>array(
'id',
'id',
'id',
array(
'name'=>'client_email',
'value'=>'substr($data->client_email, 0, 15)',
),
),
[code]protected function afterFind ()
{
parent::afterFind ();
$this->client_email = substr($this->client_email, 0, 20);
}
[/code]