Reputation: 343
Using yii-booster, I want to create a pretty simple table. The data is completely valid and works just fine using this:
$gridDataProvider = new CArrayDataProvider($model->results);
$gridColumns = array(
array('name'=>'score', 'header'=>'Score'),
array('name'=>'community', 'header'=>'Community ID'),
array('name'=>'ip', 'header'=>'IP Address')
);
$this->widget('bootstrap.widgets.TbGridView', array(
'type'=>'striped',
'dataProvider'=>$gridDataProvider,
'template'=>"{items}",
'columns'=>$gridColumns,
));
But I want the ip address to show up as a anchor, such as: <a href="steam://{ip}>{ip}</a>
, and I can't figure out how to make the data display as a link.
Upvotes: 0
Views: 449
Reputation: 5039
Something like this?
'columns' => array(
array(
'name'=>'date_added',
'type'=>'raw',
'value'=>'CHtml::link("link", array("site/index"))',
),
),
That will create a link in each row under the header of date_added (in my example)
As your columns are done with a variable I guess yours would be:
$gridColumns = array(
array('name'=>'score', 'header'=>'Score'),
array('name'=>'community', 'header'=>'Community ID'),
array('name'=>'ip', 'header'=>'IP Address', 'type'=>'raw', 'value'=>'CHtml::link("$data->ip", array("controller/action", "ip"=>$data->ip))')
);
Upvotes: 1