Revision #5 has been created by jwerner on Dec 20, 2010, 10:26:46 AM with the memo:
Modified formatting of 1st php block
« previous (#4)
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).
After that the user can see `on` and `off` values in the column, but he will not be able to filter columns typing `on` or `off` in the quicksearch field.
So we do the following thing in model `search()` function:[...]