简体   繁体   中英

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

Use properties viewButtonUrl, viewButtonLabel

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

try this

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM