Hi!
I’ve a controller action orders/export-csv wich exports a csv file.
I call it with a link from a view (with PJax) where is the gridView widjet.
I want to export the filtered models shown in the grid.
The link should have the correct parameters to make a search in ordersSearch model
$searchModel = new OrdersSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
I tryied with Url::to(['orders/export-csv',Yii::$app->request->queryParams])
but it doesn’t work, the csv is not filtered, all models are exported.
In the browser developer tools I see that the parameters passed by my link are
Thank you Wilson!
I tried also $url = Url::to(['orders/export-csv', 'order_number' => 81]);
But it doesn’t work.
I need to get all params in the filters and send them to the controller.
Ok, almost done.
The correct link is: Url::to(['orders/export-csv', Html::getInputName($searchModel,'order_number')=>Html::getAttributeValue($searchModel,'order_number')]);
Now i need to get all filters and build url dinamically