title: yii update clistview by dropdownlist
body: <p>I'm a very newbie in Yii framework. I would like to create a page. Which is when the dropdown list change, the listview/gridview will be change by dropdown value.</p>
  
  <p>this is my view </p>
  
  <pre><code>&lt;div class="row"&gt;
          &lt;?php
  
          $records = Company::model()-&gt;findAll();
          $company_list = CHtml::listData($records, 'id', 'name');
          echo CHtml::dropDownList('company_id','', $company_list,
          array(
          'onchange'=&gt;"$.fn.yiiListView.update('ajaxListView', {url: '".Yii::app()-&gt;createUrl('department/dynamicsectionlist')."?company_id='+$('#company_id option:selected').val()})",
          'prompt'=&gt;'Please select a company',
          )); ?&gt;
      &lt;/div&gt;
  
  &lt;?php
  $this-&gt;widget('zii.widgets.CListView', array(
      'dataProvider'=&gt;$dataProvider,
      'itemView'=&gt;'_view_section',
      'id'=&gt;'ajaxListView',
  ));
  ?&gt;
  </code></pre>
  
  <p>This is model</p>
  
  <pre><code>public function search()
      {
          // Warning: Please modify the following code to remove attributes that
          // should not be searched.
  
          $criteria=new CDbCriteria;
  
          $criteria-&gt;compare('id',$this-&gt;id);
          $criteria-&gt;compare('name',$this-&gt;name,true);
          $criteria-&gt;compare('p_id',$this-&gt;p_id);
          $criteria-&gt;compare('created',$this-&gt;created,true);
          $criteria-&gt;compare('updated',$this-&gt;updated,true);
          $criteria-&gt;compare('company_id',$this-&gt;company_id);
  
          return new CActiveDataProvider($this, array(
              'criteria'=&gt;$criteria,
          ));
      }
  </code></pre>
  
  <p>This is Controller</p>
  
  <pre><code>public function actionDynamicsectionlist()
      {       
          $company_id = $_POST['company_id'];
          $criteria=new CDbCriteria();
          $criteria-&gt;condition .= 't.id IN (SELECT t2.id, t2.name FROM department t2 WHERE t2.company_id = :company_id)';
  
          $criteria-&gt;params[':company_id'] = $company_id;
          $dataProvider = new CActiveDataProvider( 'Department', array( 'criteria' =&gt; $criteria, ) );
          $this-&gt;render( 'sectionlist', array( 'dataProvider' =&gt; $dataProvider ) );
  
      }
  </code></pre>
  
  <p>But it is not working. Please help me.</p>
  
  <p>Regads
  Tharsoe</p>