title: Custom Filtering For Cgridview in yii
body: <p>I am using CGridView to display results from postgres function. The CGridView is working fine. Now I want to use a different function in the model for filtering the CGridView. </p>
  
  <p>The current code for CGridView is like </p>
  
  <pre><code>$this-&gt;widget('zii.widgets.grid.CGridView', array(
      'id'=&gt;'purchase-grid',
      'itemsCssClass'=&gt;'table table-bordered table-condensed table-hover table-striped dataTable',
      'filter'=&gt;$model,
      'dataProvider'=&gt;$model-&gt;search(),
          ..............
  </code></pre>
  
  <p>The $model->search() function accepts an id which is used to select rows from the table. I am using CSqlDataProvider to run custom query in the $model->search() and returns the dataprovider. If I use the above code it will display filter textbox for all the fields in the CGridView. But the search function is using an id that is not displayed in the CGridView. So filtering is not working. So I want to use a new function for filtering which will accept the field for filtering. I tried with the  code below</p>
  
  <pre><code>$this-&gt;widget('zii.widgets.grid.CGridView', array(
      'id'=&gt;'purchase-grid',
      'itemsCssClass'=&gt;'table table-bordered table-condensed table-hover table-striped dataTable',
      'filter'=&gt;$model-&gt;filter_search(),
      'dataProvider'=&gt;$model-&gt;search(),
          ..............
  </code></pre>
  
  <p>But it shows error. Please help.</p>
  
  <p>Thanks in advance.</p>