I have been working with Yii's CGridView and I was wondering if there was any way to separate CButtonColumns, or initiate more than one at a time. So that each Button has a specific column with a specific title.
Asked
Active
Viewed 1,325 times
0
-
you can do it by overriding the view part of cgridview (you will have to extend the extension) – arkoak Jan 04 '13 at 13:00
2 Answers
0
array(
'header'=>'View',
'class'=>'CButtonColumn',
'template'=>'{view}'
),
array(
'header'=>'Update',
'class'=>'CButtonColumn',
'template'=>'{update}'
),
array(
'header'=>'Delete',
'class'=>'CButtonColumn',
'template'=>'{delete}'
),
... if that was what you meant.

zuups
- 1,140
- 1
- 11
- 17
0
If i understand correctly your question, you can, just add two arrays and define your template and configuration as following:
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'person-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'id',
'firstName',
'lastName',
'language',
'hours',
array(
'header'=>'View',
'class'=>'CButtonColumn',
'template'=>'{view}',
'buttons'=>array(
'view'=>
array(
'url'=>'Yii::app()->createUrl("person/view", array("id"=>$data->id))',
),
),
),
array(
'header'=>'Update',
'class'=>'CButtonColumn',
'template'=>'{update}',
'buttons'=>array(
'update'=>
array(
'url'=>'Yii::app()->createUrl("person/update", array("id"=>$data->id))',
),
),
)
),
));

Adler Dias
- 98
- 5