PHP code example of restlin / grid-to-session-behavior

1. Go to this page and download the library: Download restlin/grid-to-session-behavior library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

restlin / grid-to-session-behavior example snippets


/**
* 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,        
    ]);
}