Customize CGridView columns directly in your view

Comparing #2 with #3

Revision #3 was created by clapas clapas on Aug 14, 2012, 11:19:05 AM.

Missing array_search call

Content

[...]
Very often, you will want to customize a single column, while keeping the rest untouched. There are many ways to accomplish this, but I find the following to be the easiest one:


```php
$columns = array_keys($model->metaData->columns);
$columns[
array_search('column_name', $columns)] = array(
'name' => 'column_name',
'value' => ...
);
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider' => $model->search() ,
[...]