Created
September 17, 2015 21:18
-
-
Save maximishchenko/09e122ffb5d8ca96df00 to your computer and use it in GitHub Desktop.
Yii link inside GridView
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Used TbGridView, if Bootstrap extension isn't used - use CGridview | |
// <grid-id> - id of grid (must be changed) | |
$this->widget('bootstrap.widgets.TbGridView',array( | |
'id'=>'<grid-id>', | |
'dataProvider'=>$model->search(), | |
'filter'=>$model, | |
'columns'=>array( | |
// number rows | |
array( | |
'header' => '№', | |
'value' => '$row+1', | |
'htmlOptions'=>array('width'=>'10'), | |
), | |
// checkboxes | |
array( | |
'class'=>'CCheckBoxColumn', | |
// id of column | |
'id'=>'<ids>', | |
), | |
array( | |
'name'=>'<field_name>', | |
'type'=>'raw', | |
// target _blank - open view action for record in new tab (that save filter value) | |
'value' => 'CHtml::link($data-><field_name>, Yii::app()->createUrl("<module>/<controller>/<view>",array("id"=>$data->primaryKey)), array("target"=>"_blank"))', | |
), | |
// Used TbButtonColumn, if Bootstrap extension isn't used - use CButtonColumn | |
array( | |
'class'=>'bootstrap.widgets.TbButtonColumn', | |
), | |
), | |
)); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment