[英]yii CButton Column
How do i modify the links inside the CGridview? 如何修改CGridview中的链接?
This is from my view page: 这是从我的视图页面:
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$new,
'columns'=>array(
'book.title',
'book.author',
'book.edition',
'date_borrowed',
'borrowed_status',
'date_returned',
'returned_status',
array(
'class'=>'Viewonly',
),
)
));
then from my Components: 然后从我的组件:
class ViewOnly extends CButtonColumn {
public $template = '{view}';
}
what i want to happen "FOR EXAMPLE" if i click the view button in my CGridview, it will redirect me to http://www.google.com?action=someaction . 我想要发生什么“例如”如果我单击CGridview中的视图按钮,它会将我重定向到http://www.google.com?action=someaction 。 how can i do this? 我怎样才能做到这一点?
You don't need a separate button class. 您不需要单独的按钮类。 Do something like this: 做这样的事情:
array(
'class'=>'CButtonColumn',
'template'=>'{view} {google}',
'viewButtonUrl=>'Yii::app()->createUrl("http://google.com/",array("q"=>$data->name))',
'google'=>array(
... Init code for this button here
),
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.