user2564443
user2564443

Reputation: 23

Yii2 How can append additional paramater when using gridview filter

I want to append a parameter to the auto generated parameters of filtermodel in GridView
How do I add additional parameters?

Upvotes: 2

Views: 1295

Answers (1)

ck_arjun
ck_arjun

Reputation: 1417

You can use 'filterUrl' property of GridView

In your GridView

<?= GridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'filterUrl' => ['YOUR_CONTROLLER_ACTIONID_HERE','date' => date('Y-m-d')],
    'columns' => [   
    ],
]); ?>

first parameter to 'filterUrl' is your action id. After that you can give your additional url parameters as key value pair

Upvotes: 3

Related Questions