Remember Filters Behavior

Hello Forum.

Has anyone used the Yii-1.1 ERememberFiltersBehavior extension (http://www.yiiframework.com/extension/remember-filters-gridview) in Yii-2?

I do not want to use the Kartik DynaGrid yet.

I want to experiment with the default Yii GridView for a while.

Thank You.

I solved it this way:

To keep the columns filters/sort values of a GridView through the session

Just add these four lines at the beginning of the actionIndex

public function actionIndex()


{


    // Just add these four lines at the beginning of the actionIndex


    if (count(Yii::$app->request->queryParams)==0)


        Yii::$app->request->queryParams = Yii::$app->session->get('MyModelIndexParams');


    else


        Yii::$app->session->set('MyModelIndexParams', Yii::$app->request->queryParams);





    $searchModel = new MyModelSearch();


    $dataProvider = $searchModel->search(Yii::$app->request->queryParams);





    ...

Enjoy!!