Bianca
(Biancajsen)
June 28, 2012, 8:54am
1
I am trying to insert a link in a column of a cgridview. This link will lead to another cgridview based on an attribute value of the row in the 1st cgridview. I am having a parse error with a particular CHtml::link
Here’s is the code:
<?php $dataProvider=new CActiveDataProvider('Department'); ?>
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'department-grid',
//'dataProvider'=>$dataProvider,
'dataProvider'=>$model->search(),
'columns'=>array(
'id',
'name',
array('name'=>'empname', 'type'=>'raw', 'value'=>'CHtml::link('Eyees', $this->createUrl('employee/admin'),array('id'=>'$data->id'))'),
array(
'class'=>'CButtonColumn',
),
),
)); ?>
Am I missing something? I’ve edited several times but without success (
use like this, need class CLinkColumn
array(
'class'=>'CLinkColumn',
'labelExpression'=>'$data->name',
'urlExpression'=>'Yii::app()->createUrl("/courses/exams/create",array("exam_group_id"=>$data->id,"id"=>$_REQUEST["id"]))',
'header'=>'Name',
'headerHtmlOptions'=>array('style'=>'color:#FF6600')
),
Bianca
(Biancajsen)
June 28, 2012, 9:30am
3
Thanks Rajith,
I’ll try it and get back to you. Hope it works: I’ve been wasting hours on this!
Bianca
(Biancajsen)
June 28, 2012, 12:22pm
4
Hi Rajith,
Have not been able to make it work: parse error in syntax
mbi
(mbi)
June 28, 2012, 1:23pm
5
Bianca
(Biancajsen)
June 28, 2012, 2:16pm
6
It works!!!!!! I do not know how to thank you. I’ve wasted hours on this
Bianca
PS Thanks to all of you who have tried to help me. This YII community is wonderful !!