customize a CButtonColumn with an Html link

477 Views Asked by At

I use CButtonColumn look like this:

array('header'=>'Operations',
'class'=>'CButtonColumn',
'template'=>'{view}{update}',
'buttons'=>array
('view' => array
('url'=>'Yii::app()->createUrl("Unit/view", array("id"=>$data->Id))',),

It works fine, but instead of this page I want to display another page

This one

  echo CHtml::link($data->project->Title, 
   'http://www.****.***/en/unit_detail/'.$data->Id, );

How can I insert this Html link in a CButtonColumn

2

There are 2 best solutions below

4
Alex On BEST ANSWER

Use properties viewButtonUrl, viewButtonLabel

array('header'=>'Operations',
    'class'=>'CButtonColumn',
    'template'=>'{view}{update}',
    'viewButtonUrl'=>'"http://www.****.***/en/unit_detail/".$data->Id'
    ....
6
Let me see On

try this

'buttons'=>array
('view' => array
(
'label'=>'$data->project->Title',
'url'=>'urlencode("http://www.****.***/en/unit_detail/$data->Id")',
'imageUrl'=> false),