Changes
Title
unchanged
Using standard filters in CGridView custom fields
Category
unchanged
How-tos
Yii version
unchanged
Tags
unchanged
CGridView, interface, filters, search
Content
changed
[...]
So we do the usual thing:
```php
<?php $this->widget('zii.widgets.grid.CGridView', array(
//.....
array(
'name'=>'switch',
'header'=>'Switch',
'type'=>'raw',
'value'=>'Mii::getSwitch($data->switch)'
),
//.....
),
));
```
`Mii::getSwitch` - is my own helper witch returns `on` or `off` according to the current switch value (in the original it returns an image).[...]
$am=authorsModel::model()->findAll($criteria);
if(empty($am)) return 0;
if(count($am) == 1) return $am[0]->attributes['admuthor_id'];
$ids = array();
foreach($am as $a_id)
{
$ids[] = $a_id->attributes['a
dmuthor_id'];
}
return $ids;
}
```