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

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['a
dmuthor_id']; $ids = array(); foreach($am as $a_id) { $ids[] = $a_id->attributes['admuthor_id']; } return $ids; } ```
14 0
16 followers
Viewed: 74 085 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