Monday, June 04, 2012

How to Specify each row's id with Zii Widgets Grid CGridView in Yii


When I tried to use zii.widgets.grid.CGridView in a different controller, CButtonColumn would mess up because the id would return the controller the CGridView is placed.

To specify each row's id for the CButtonColumn, you can do the following.  ^^

$this->widget('zii.widgets.grid.CGridView', array(
 'id'=>'label-grid',
 'dataProvider'=>$labelmodel,
 'columns'=>array(
  'id',
  'label',
  array(
                    'class'=>'CButtonColumn',
                    'viewButtonUrl'=>
                     'Yii::app()->controller->createUrl("label/view", 
                                       array("id"=>$data->id))',
                    'updateButtonUrl'=>
                     'Yii::app()->controller->createUrl("label/update",       
                                       array("id"=>$data->id))',
                    'deleteButtonUrl'=>
                   'Yii::app()->controller->createUrl("label/delete", 
                                      array("id"=>$data->id))',
  ),
 ),
));  

1 comment:

waladaebach said...

How to open an MGM Grand casino in Las Vegas
The 제주도 출장샵 only casino 제주 출장마사지 on the Strip 포항 출장샵 in Vegas has three full floors. The 1,200-square-foot 안양 출장마사지 grand 군산 출장안마 hotel and casino is located on the Las Vegas Strip