Reputation: 27
In my yii2 project, I'm using Pjax GridView.
My index
page:
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'batch',
[
'attribute' => 'file_import',
'format' => 'raw',
'value'=>function ($data) {
return Html::a($data->file_import, ['/device/index', 'DeviceSearch', 'batch' => $data->batch]);
},
],
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
The link in the file_import
column goes to http://localhost/index.php/device/index?1=DeviceSearch&batch=200325806610154437
. But in this url, all the data is showing instead of showing only the search result. I wanted to set the file_import
column as an url which will show only the search result by the provided parameter in the url.
Thank you in advance.
Upvotes: 0
Views: 479
Reputation: 18021
Change URL route to
['/device/index', 'DeviceSearch[batch]' => $data->batch]
Upvotes: 1