title: how to change grid view through Ajax? yii2
body: <p>First of all i am working with yii2.0 framework.</p>
  
  <p>Right, i have a gridview that pulls data from my database. It currently works and if i use any of the searches it will reload the page with the new data. </p>
  
  <p>However i now have created some dropdownlist categories. Basically there are three tiers of categories , so a main category subcategory and child category. At the moment i have two ajax requests that will populate the sub and child category when the dropdownlist changes. (It populates the categories from my database).</p>
  
  <p>Now i want the gridview to display the cases that are linked to the child categories. So when i choose my first category then choose my second and child category the gridview displays the content that relates to it.</p>
  
  <p>At the moment my controller renders the searchModel + dataProvider for the grid view <strong>as seen below:</strong>:</p>
  
  <pre><code>public function actionIndex()
  {
      $searchModel = new CaseSearch();  
      $allCategory = Category::find()-&gt;all();
  
      $dataProvider = $searchModel-&gt;search(Yii::$app-&gt;request-&gt;queryParams);
  
      return $this-&gt;render('index', [
          'searchModel' =&gt; $searchModel,
          'dataProvider' =&gt; $dataProvider,
          'allCategory' =&gt; $allCategory
      ]);
  }
  </code></pre>
  
  <p>and in my view it displays the data with this::</p>
  
  <pre><code>&lt;?= GridView::widget([
      'dataProvider' =&gt; $dataProvider,
      'filterModel' =&gt; $searchModel,
      'columns' =&gt; [
          'case_id',
          'name',
          'judgement_date',
          'year',
          ['class' =&gt; 'yii\grid\ActionColumn'],
      ],
  ]); ?&gt;
  </code></pre>
  
  <p>How should i go about achieving this? should i create something _grid.php which i can then render from my view and send the ajax request there?</p>