Issue
I know this could be an unusual request but I hope someone can help me.
In my gridview, I need to get the filter's values, for example, if I select a specific date to display at my gridview as filter, I want to get the date selected, my goal is to be able to make a query with all filters. I do not know if there is a way to do it.
Thanks :)
Solution
You can access the filter values in your controller. In the example below use your filter field name index in the place of myFilterName
.
public function actionIndex($indexDeleted=false)
{
$queryparams = Yii::$app->request->queryParams;
$myDateValue = isset($queryparams['myFilterName']) ? $queryparams['myFilterName'] : null;
$searchModel = new RecipeSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
...
Answered By - Tibor Nagy
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.