I placed a filter into a CGridView and it creates a drop down list of all business names however when I select a value in the drop down no results are returned. The admin view is for the Client model and the code is
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'client-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'provider_id',
array(
'name'=>'business_name',
'filter'=>CHtml::listData(Client::model()->findAll(array('condition'=>'active=1',
'order'=>'business_name ASC')),
'id','business_name'),
'value'=>'CHtml::encode($data->business_name)',
),
'business_address',
'business_suburb',
'business_postcode',
......
The drop down lists all the Client business names however when I select a Business Name from the drop down NO results are returned from the search. Any advice would be appreciated.
NOTE:
If I use the following code and generate a drop do list of id’s then the search function works.
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'client-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'provider_id',
array(
'name'=>'business_name',
'filter'=>CHtml::listData(Client::model()->findAll(array('condition'=>'active=1',
'order'=>'business_name ASC')),
'business_name','id'),
'value'=>'CHtml::encode($data->business_name)',
),
'business_address',
'business_suburb',
'business_postcode',
......
It seems the business name as a string is not returning a match.