Yii Framework Forum: Display Link On Cgridview - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Display Link On Cgridview Rate Topic: -----

#1 User is offline   Agus Zulvani 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 01-July 14

Posted 01 July 2014 - 06:03 PM

Hi all,

I'm new in Yii, I have a problem when I want to display link on CGridView

...
array(
'name'=>'Type',
'value'=>'(isset($data->material_purchasing_id) ? CHtml::link($data->materialPurchasing->no, Yii::app()->urlManager->createUrl("materialPurchasing/view",array("id"=>$data->materialPurchasing->id))) : "BUDGETING")',		),
...


it will be display: <a href="/yii/hda/index.php/materialPurchasing/2">#PR1407000002</a>
not render a link.

can you help me?

Thanks
0

#2 User is offline   adoming3 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 20
  • Joined: 31-July 12

Posted 02 July 2014 - 02:29 AM

Try adding type raw.

...
array(
'name'=>'Type',
'type'=>'raw',
'value'=>'(isset($data->material_purchasing_id) ? CHtml::link($data->materialPurchasing->no, Yii::app()->urlManager->createUrl("materialPurchasing/view",array("id"=>$data->materialPurchasing->id))) : "BUDGETING")',		),
...

0

#3 User is offline   le_top 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 315
  • Joined: 08-June 10
  • Location:France

Posted 03 July 2014 - 01:25 PM

Hi
Try this: http://www.yiiframew...-a-cdatacolumn/ .

It is essentially the same as what was suggested, but it adds a level of abstraction and will keep your gridview definition more readable.

Mario
0

#4 User is offline   Agus Zulvani 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 01-July 14

Posted 03 July 2014 - 06:46 PM

View Postadoming3, on 02 July 2014 - 02:29 AM, said:

Try adding type raw.

...
array(
'name'=>'Type',
'type'=>'raw',
'value'=>'(isset($data->material_purchasing_id) ? CHtml::link($data->materialPurchasing->no, Yii::app()->urlManager->createUrl("materialPurchasing/view",array("id"=>$data->materialPurchasing->id))) : "BUDGETING")',		),
...



thanks admoming, it's work for me :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users