CGridView 显示字段上面加link怎么加呢?
谢谢
CGridView 显示字段上面加link怎么加呢?
谢谢
try:
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$dataProvider,
'columns'=>array(
'title', // display the 'title' attribute
'category.name', // display the 'name' attribute of the 'category' relation
'content:html', // display the 'content' attribute as purified HTML
array( // display 'create_time' using an expression
'name'=>'create_time',
'value'=>'date("M j, Y", $data->create_time)',
),
array( // display 'author.username' using an expression
'name'=>'authorName',
'value'=>'CHtml::link($data->author->username,$url)',
// ~~~~~~~~~~~~~~~~~~~~whatever expression here
),
array( // display a column with "view", "update" and "delete" buttons
'class'=>'CButtonColumn',
),
),
));
注意,加上’type’=>‘raw’
或者用CLinkColumn
用这个解决了。。
谢谢
用CLinkColumn
以后就不能排序了。
Hello guys,
can someone please post an example on how to use CLinkColumn, i have been trying for the last hour how to implement this with no success. I have a field call ‘url’ and i want to turn it to a link.
xie xie ni
我也想知道CLinkColumn 怎么给url加个删除记录的链接。
这个源代码里面有的。
好像这里也有的,找找