title: How to set Yii2 ActiveDataProvider's page dynamically with jquery
body: <p>I'm building an web-based application using Yii2. I used Yii2's GridView and I would like to use dropdown for the pagination instead of bootstrap's default pagination which used series of button. My GridView is wrapped with a Pjax. This is my current code:</p>
  
  <pre><code>&lt;div class="custom-pagination"&gt;
      Page &lt;?=Html::dropDownList('myPagination', '1', $pageOptions);?&gt; Of &lt;?=$pageCount;?&gt;
  &lt;/div&gt;
  
  //********
  my gridview which is wrapped by pjax
  //********
  
  &lt;script type="text/javascript"&gt;
  var base = "&lt;?=Yii::$app-&gt;request-&gt;getAbsoluteUrl();?&gt;";
  $(".custom-pagination select").on('change', function(e){
      $.get( base, {'page': $(this).val()}, function( data ) {
          $.pjax.reload({container:'#kv-grid-demo-pjax', url: base});
      });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>On server side:</p>
  
  <pre><code>public function actionIndex()
  {
      $searchModel = new RotaryInputSearch();
      $dataProvider = $searchModel-&gt;search(Yii::$app-&gt;request-&gt;queryParams);
  
      $pageCount = ceil($dataProvider-&gt;getTotalCount() / $dataProvider-&gt;getPagination()-&gt;getPageSize());
      $pageOptions = array();
      for($i=1; $i&lt;=$pageCount; $i++) {
          $pageOptions[$i] = $i;
      }
  
      if (isset($_GET['page'])) {
          $dataProvider-&gt;pagination-&gt;page = $_GET['page'];
          echo json_encode('success');
          die();
      }
  
      return $this-&gt;render('index', [
          'dataProvider' =&gt; $dataProvider,
          'searchModel' =&gt; $searchModel,
          'pageCount' =&gt; $pageCount,
          'pageOptions' =&gt; $pageOptions,
      ]);
  }
  </code></pre>
  
  <p>The pjax's working and the grid is reloaded, but it won't turn to other page and stays on page 1. I have no idea what I should do with this. Please help...</p>