Mushroom
Mushroom

Reputation: 285

customize a CButtonColumn with an Html link

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

Upvotes: 3

Views: 490

Answers (2)

Alex
Alex

Reputation: 8072

Use properties viewButtonUrl, viewButtonLabel

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

Upvotes: 2

Let me see
Let me see

Reputation: 5094

try this

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

Upvotes: 1

Related Questions