title: yii CGridView dataprovider and filter
body: <p>I know we can show a gridview with a model and it's search method and filter the results, but can we make a gridview with another dataprovider and another model like this and filter its results? Does filter needs to be a part of dataprovider?</p>
  
  <pre><code>$attr = Yii::app()-&gt;request-&gt;getParam($name);
  
  $model = new User('search');
  $model-&gt;unsetAttributes();
  $model-&gt;setAttributes($attr);
  
  $this-&gt;widget('zii.widgets.grid.CGridView', array(
  'dataProvider' =&gt; $myDataProvider,
  'filter' =&gt; $model,
  'columns' =&gt; array(
      array(
          'name' =&gt; 'username',
          'type' =&gt; 'raw',
          'value' =&gt; 'CHtml::encode($data-&gt;username)'
      ),
      array(
          'name' =&gt; 'email',
          'type' =&gt; 'raw',
      ),
  ),
  </code></pre>
  
  <p>));</p>
  
  <p>The above code doesn't work and I need to add a filter on a previously made data provider.</p>
  
  <p>Btw <code>$attr</code> has a valid data, but grid is not filtered.</p>