title: yii2 - use pjax with a gridview inside a modal window
body: <p>I'm trying to use a gridView on a modal dialog, but when I search something in it (filtering), all page refresh and obviously the modal closes.
  what I need to make it works properly?.</p>
  
  <p>my code: </p>
  
  <p>view</p>
  
  <pre><code>use yii\widgets\Pjax;
  
  &lt;?php
      Modal::begin([
          'id' =&gt; 'modal',
          'header' =&gt; '&lt;h2&gt;Students&lt;/h2&gt;',
          'toggleButton' =&gt; ['label' =&gt; 'Show Students'],
      ]);
      Pjax::begin();
      echo GridView::widget([
              'dataProvider' =&gt; $dataProvider,
              'filterModel' =&gt; $searchModel,
              'columns' =&gt; [
                  'student_code',
                  'name',
                  'grade',
              ],
           ]);
      Pjax::end();
      Modal::end();
  ?&gt;
  </code></pre>
  
  <p>controller</p>
  
  <pre><code>public function actionDetail($id)
      {
          $model = $this-&gt;findModel($id);
  
          $searchModel = new DatosBasicosSearch();
          $dataProvider = $searchModel-&gt;search(Yii::$app-&gt;request-&gt;queryParams);       
  
          if ($model-&gt;load(Yii::$app-&gt;request-&gt;post()) &amp;&amp; $model-&gt;save()) {
              return $this-&gt;redirect(['view', 'id' =&gt; $model-&gt;id]);
          } else {
              return $this-&gt;render('detail', [
                  'model' =&gt; $model,
                  'searchModel' =&gt; $searchModel,
                  'dataProvider' =&gt; $dataProvider,
              ]);
          }
      }
  </code></pre>
  
  <p>I have searched on the documentation, tutorials from oficial page and I have find a lot of posts related, but i can't solve the problem.</p>
  
  <p>Thanks for any help.</p>