Hi,
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.
The current code for CGridView is like
$this->widget(‘zii.widgets.grid.CGridView’, array(
'id'=>'purchase-grid',
'itemsCssClass'=>'table table-bordered table-condensed table-hover table-striped dataTable',
'filter'=>$model,
'dataProvider'=>$model->search(),
..............
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
$this->widget(‘zii.widgets.grid.CGridView’, array(
'id'=>'purchase-grid',
'itemsCssClass'=>'table table-bordered table-condensed table-hover table-striped dataTable',
'filter'=>$model->filter_search(),
'dataProvider'=>$model->search(),
..............
But it shows error. Please help.
Thanks in advance.