Use Yii Filter With Additionally Added Column In Cgrid View

I am new in yii. I add a extra column in my yii grid; as-

$this->widget(‘zii.widgets.grid.CGridView’, array(

‘id’=>‘event-manage’,

‘dataProvider’=>$model->search(),

‘filter’=>$model,

‘columns’=>array(

array(

           'class'=>'IndexColumn',


   ),

‘groom’, //alias

'bride',     //alias

‘event_name’,

‘event_venue’,

… …

Here is my model TblWeddingEventslist is my model class.

public function search()

{

$criteria=new CDbCriteria;


var_dump($this->groom);





$criteria->select="


t.*,


CASE 


WHEN (event_name='Wedding' or info_source = 1) THEN  groom.column_1


ELSE


'-'


END AS groom,





CASE 


WHEN (event_name='Wedding' or info_source != 1) THEN  bride.column_1


ELSE


'-'


END AS bride


";





$criteria->join="


INNER JOIN 


    wedding_info AS t1 


ON 


    t.wedding_id = t1.id


INNER JOIN 


    persov_data_view AS groom 


INNER JOIN 


    person_data_view AS bride 


ON (groom.id = t1.contact_groom AND bride.id = t1.contact_bride)";





$criteria->compare('id',$this->id,true);


$criteria->compare('wedding_id',$this->wedding_id,true);


$criteria->compare('event_name',$this->event_name,true);


$criteria->compare('event_venue',$this->event_venue,true);


$criteria->compare('t.status',1);





$sort = new CSort();


$sort->attributes = array(


'groom'=>array(


'asc'=>'groom ASC',


'desc'=>'groom DESC'


),


'bride'=>array(


'bride ASC',


'desc'=>'bride DESC'


));





return new CActiveDataProvider($this, array(


    'criteria'=>$criteria,


    'sort'=>$sort     





));

}

I added two public variable as $groom and $bride and on filtering values are being storing in them. but I don’t know how to write compare condition for use filter. I used

$criteria->compare(‘groom’,$this->groom,true) but this gives error as groom is not a column in my db.

1) you can defind those varible on model rule function (‘on’=>‘search’)

for e.g


array('id,groom,bride', 'safe', 'on'=>'search'),

2) and if you want to display the condition record you can write a custom query on model search function

for e.g


if (isset($this->groom) && !empty($this->groom)) {

  //write a query

 }



3) if you want to change the filter you can write a custom query on filter

for e.g




array(

                'name'=>'user_id',

                'value'=>'GxHtml::valueEx($data->user,\'fullname\')',

                'filter'=>GxHtml::listDataEx(User::model()->findAll('user_type=\'venue\''), 'id', 'fullname'),

                ),

i hope you can understand me.