0

CGridview 内のリンクを変更するにはどうすればよいですか?

これは私のビューページからのものです:

$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',
    ),
)
));

次に、私のコンポーネントから:

class ViewOnly extends CButtonColumn {
    public $template = '{view}';
}

CGridview の表示ボタンをクリックすると、「例として」発生したいことhttp://www.google.com?action=someactionにリダイレクトされます。これどうやってするの?

4

2 に答える 2

2

別のボタンクラスは必要ありません。このようなことをします:

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
   ),
)
于 2012-04-01T06:45:39.550 に答える
0

ここにドキュメントがあります。確認できます。

ちなみに、ドキュメントによると、次のurlパラメーターを使用できますArray

array(
    'url' => '', //url comes here
),

編集:配列は の外にある必要がありますcolumns

于 2012-03-08T16:09:20.487 に答える