Difference between #4 and #5 of
Using standard filters in CGridView custom fields

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:
[...]
14 0
16 followers
Viewed: 74 079 times
Version: 1.1
Category: How-tos
Written by: GOsha
Last updated by: jwerner
Created on: Dec 13, 2010
Last updated: 13 years ago
Update Article

Revisions

View all history