Is there a way to add a link in the GridView, I am trying to get the one of the columns to be a link to a modal, I am trying with:
['class' => 'yii\grid\DataColumn',
'value' => function ($data) {
return '<a href="some"'.$data->shortname.'>'.$data->shortname.'</a>';
},
],
But it is showing it as it is and not as a proper html a link.
Thanks
Matt
I am using this code to get a link in my column:
['class' => 'yii\grid\ActionColumn',
'header' => 'ShortName',
'template' => '{view}',
'buttons' => [
'view' => function ($url, $model) {
return Html::a($model->shortname, $url, [
'class' => 'view-link',
]);
},
],
],
But with this i am unable to create a filter for this column, is there a different way, where I can have the column as a link and be filterable?
lestat1968
(Baldoromano1968)
June 10, 2014, 9:25am
3
try
['class' => 'yii\grid\DataColumn',
'value' => function ($data) {
return '<a href="some"'.$data->shortname.'>'.$data->shortname.'</a>';
},
'format' => 'raw',
],
Tried it, but no success.
Was returning a link, but the column wasnt filterable, nor did it have a heading. Also couldnt add a class to it, as the class => ‘view-link’ is being watched by pjax to open a pop up modal.