Retrieve $model->id(this is a data of model $model) in the filter section of CGridView

Hi professional developers, i need to know how could i catch the model data in the filter section of the CGridView, here is my code:


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








                        'header'=>'Employee Type',


			'filter'=>CHtml::listData(Employee::model()->findAll(), 'id', 'employee_type'),





                        'class' => 'CButtonColumn',






in the filter section, it shows all employee_type from the database. But i want to set a condition inside the findAll(), like , findAll(array(‘condition’=>‘id=’.$model->employee_id)).

But i cannt retrieve the model data.

Please can any one of you help me ?

Again thanks for reading the post.

Working with Database - Reading AR-Record

Employee::model()->findAll('your_column = :your_value', array('your_value'=>123));

Many thanks for reply bro,

but i want that values which-es are come from actionAdmin() as $data, like $data->id,

but i cannt retrieve those datas in the filter section of CGridView,.


Ok, i solved like this,

in my views/admin.php->



                        'header'=>'Employee Name',





and in my model,

 public function allemployeeFromThis() {

          $criteria = new CDbCriteria;

          $criteria->together  =  true;

          $criteria->with = array('employee');


        return CHtml::listData(Users::model()->findAll($criteria), "employee_id", "");


where, employee is my relational table with users.

Hope it can help others. thanks.