I’m trying to get a column to display links that should be pointing to individual records, but I can’t seem to find how it should be done.
Here’s a snippet of my view file:
<?php
$this->widget('bootstrap.widgets.TbGridView', array(
'type'=>'stripped condensed',
'dataProvider'=>$dataProvider,
'template'=>'{pager}{items}{pager}{summary}',
'columns'=>array(
array(
'name'=>'crew_code',
'header'=>'crew code',
'type'=>'raw',
'value'=>"CHtml::link('crew_code', array('test/test'))"),
array('name'=>'name', 'header'=>'company name'),
array('name'=>'phone', 'header'=>'phone number'),
array('name'=>'email', 'header'=>'email address'),
)
));
?>
If I remove the value attribute for crew code column, then the list is displayed just as I need it to be displayed (except it’s not a link), however I’m trying to modify it to be a link that will point to each record. To do that I need to add value attribute, yet when I add it, crew_code which is my table’s primary key turns into text, so instead of codes that I was able to see without the value attribute, I can only see actual “crew_code” text this time around.
How can I do this?
here’s my controller index:
public function actionIndex()
{
$dataProvider=new CActiveDataProvider('Crew', array(
'pagination'=>array(
'pageSize'=>30
),
));
$this->render('index',array(
'dataProvider'=>$dataProvider,
));
}