How To Properly Set Cgridview Column Value

Hi, I’m a beginner here, very interested in Yii.

Lately I’ve been trying to create a project with Yii,

But I come across this problem where the CGridVeiw in Admin controller is showing the value of area_id instead of the name

this is what I’ve tried, but it’s not working

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










                    'name' => 'area_id',

                    'value' => '$model->area->name'







please kindly guide me, thanks before

You should use $data instead $model inside cgridview.


                    'name' => 'area_id',

                    'value' => '$data->area->name'


It’s working , thanks !!

I don’t know that $data exists, but where’s it coming from ?