restlin/grid-to-session-behavior This is yii2 controller behavior. It can save and restore grid filters, page and sort in session.

extensioncontrollergridsession

GridToSessionBehavior

This is yii2 controller behavior. It can save grid filters, page and sort in session and restore when user return to action with grid.

example for using this behavior in controller:

/**
* Lists all Document models.
* @param integer $mode in this case this parameter is indicator for restore params from session
* @return mixed
*/
public function actionIndex($mode=null)
{
    $searchModel = new DocumentSearch();
    if(!$mode) {
        $this->loadParams();
        $mode = Yii::$app->request->get('mode');
    }
    $this->saveParams('DocumentSearch',['mode'=>1]);    
    $dataProvider = $searchModel->search(Yii::$app->request->queryParams);        

    return $this->render('index', [
        'searchModel' => $searchModel,
        'dataProvider' => $dataProvider,        
    ]);
}

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

Comments



1.0.2 is the latest of 3 releases



GPL-3.0-or-later license
Stats
0 github stars & 0 github forks
0 downloads in the last day
0 downloads in the last 30 days
10 total downloads