3

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

Mushroom
  • 285
  • 2
  • 17

2 Answers2

2

Use properties viewButtonUrl, viewButtonLabel

array('header'=>'Operations',
    'class'=>'CButtonColumn',
    'template'=>'{view}{update}',
    'viewButtonUrl'=>'"http://www.****.***/en/unit_detail/".$data->Id'
    ....
Alex
  • 8,055
  • 7
  • 39
  • 61
  • but i want to insert this limk 'http://www.****.***/en/unit_detail/' not 'Yii::app()->createUrl("Unit/view", this one already works – Mushroom Apr 11 '14 at 05:12
  • 1
    'viewButtonUrl'=>'"http://www.****.***/en/unit_detail/".$data->Id' this shuld work too – Alex Apr 11 '14 at 05:14
  • one more thing please if you don't minde, how can i make the view page open in a new tab or window ? – Mushroom Apr 11 '14 at 05:39
  • 1
    Add in array 'viewButtonOptions'=>['target'=>'_blank'] – Alex Apr 11 '14 at 06:01
1

try this

'buttons'=>array
('view' => array
(
'label'=>'$data->project->Title',
'url'=>'urlencode("http://www.****.***/en/unit_detail/$data->Id")',
'imageUrl'=> false),
Let me see
  • 5,063
  • 9
  • 34
  • 47