高级搜索选项在gridview中不起作用(使用YII框架)

I am new at coding in php and using Yii Framework.I am unable to find the solution.I have a search option in a page where some information are shown of many users.For searching purpose there is a search function in my model.Here is the search function code.

public function search()
    {


        $criteria=new CDbCriteria;
        $criteria->compare('cv_id',$this->cv_id,true);
        $criteria->compare('user_id',$this->user_id,true);
        $criteria->compare('job_title_id',$this->job_title_id);
        $criteria->compare('cv_type',$this->cv_type,true);
        $criteria->compare('version_id',$this->version_id,true);
        $criteria->compare('upload_date',$this->upload_date,true);
        $criteria->compare('update_date',$this->update_date,true);
        $criteria->compare('file_name',$this->file_name,true);
        $criteria->compare('next_review_date',$this->next_review_date,true);
        $criteria->compare('review_status',$this->review_status,true);
        $criteria->compare('file_location',$this->file_location,true);
        $criteria->compare('is_current',$this->is_current,true);
        $criteria->compare('status',$this->status,false);

        return new CActiveDataProvider($this, array(
            'criteria'=>$criteria,
                'sort'=>array(


        'defaultOrder'=>'upload_date DESC'
        )
        ));
    }

this function doesn't work if i declare a condition within the search function.I need to declare the condition for showing the current data of the user in the page.here is the condition code:

$criteria->condition = "is_current='yes'";

If i omit this condition code line the search function works fine.But i need this code line to show current data of the user.So what can i do...does any one have a solution....Please provide me with code example as i am not good at coding....

CDbCriteria has several methods to specify conditions, e.g. compare, addColumnCondition, ... which will add each condition to the condition property of CDbCriteria.

I assume that you declared your condition after all the compare conditions, which would overwrite all of the previous ones.

I suggest to replace the current compare condition for is_current as follows:

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

by

$criteria->compare('is_current', 'yes');

Keep in mind to disable the is_current search field in the gridview, because that input won't be taken into account anymore.