how can I add an URL link on any row items I have in my GridView?
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
'email:email',
'vat_code',
'code',
'company',
'country',
'city',
'address',
'phone',
'name',
['class' => 'yii\grid\ActionColumn',
'template' => '{update} {delete}',
'buttons' => ['update' => function ($url, $model) {
$url = Yii::$app->urlManager->createUrl(['user/update', 'id' => substr($url, strpos($url, 'id=')+3, strlen($url)), 'type' => substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], 'user/')+5, 8)]);
return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [
'title' => Yii::t('app', 'Update'),]);
},
'delete' => function ($url, $type) {
$url = Yii::$app->urlManager->createUrl(['user/delete', 'id' => substr($url, strpos($url, 'id=')+3, strlen($url)), 'type' => substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], 'user/')+5, 8)]);
return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, [
'title' => Yii::t('app', 'Delete'),]);
}],
],
],
]); ?>
I need to have the same edit URL on email row as it is on pencil icon action column. I use Yii 2.0 version.
I tried to implement it like this: Add column as link in CGridView But no luck.