title: Yii2 gridview export to pdf with custom template and filtered data
body: <p>I'm trying to export my gridview into pdf with no luck :(. This is a part of my controller code:</p>
  
  <pre><code>class LntTripsController extends Controller
  {
      protected $repquery; // my only idea is to pass query parameters via global variable
      .................
      public function actionIndex()
      {
          $searchModel = new LntTripsSearch();
          $dataProvider = $searchModel-&gt;search(Yii::$app-&gt;request-&gt;queryParams);
  
          $this-&gt;repquery = Yii::$app-&gt;request-&gt;queryParams; // save request here
          return $this-&gt;render('index', [
              'searchModel' =&gt; $searchModel,
              'dataProvider' =&gt; $dataProvider,
          ]);
      }
  .............
  //Here I do export with custom template: 
  
      public function actionReport() {
  
          $searchModel = new LntTripsSearch();
          $dataProvider = $searchModel-&gt;search($this-&gt;repquery); //restore request here
  
          $content = $this-&gt;render('report', [
              'searchModel' =&gt; $searchModel,
              'dataProvider' =&gt; $dataProvider,
          ]);
  
          $pdf = Yii::$app-&gt;pdf;
          $mpdf = $pdf-&gt;api;
          $mpdf-&gt;WriteHtml($content);
          return $pdf-&gt;render();
      }
  }
  </code></pre>
  
  <p>The function <code>actionIndex()</code> works fine, but <code>actionReport()</code> always prints out the full table even when it was filtered in <code>actionIndex()</code>. Variable <code>$this-&gt;repquery</code> always <code>NULL</code> in <code>actionReport()</code>. </p>