No Value Shows In Cgridview

In the CGridView, i want to show my value, but it show value null by $model:




var_dump($model->status);


// Result is NULL



But in CGridView it show the exact value,




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

	'id' => 'form-grid',

	'dataProvider' => $model->search(),

	'filter' => $model,

	'columns' => array(

    	array(

        	'name'=>'status',

        	'value'=> isset($model->status) ? $model->getStatus($model->status) : '',

    	),

    	array(

        	'name'=>'level',

        	'value'=> isset($model->level) ? $model->getLevel($model->level) : '',

    	),

    	

    	'survey_No',

    	array(

        	'class' => 'CButtonColumn',

        	'buttons' => array(

            	'view' => array(

                	'url' => '$this->grid->controller->createUrl("view", array("form"=>$data->primaryKey))',

                	'options' => array('title' => 'View'),

            	),

            	'update' => array(

                	'url' => '$this->grid->controller->createUrl("edit", array("form"=>$data->primaryKey))',

                	'options' => array('title' => 'Edit'),

            	),

            	'delete' => array(

                	'url' => '$this->grid->controller->createUrl("delete", array("form"=>$data->primaryKey))',

                	'options' => array('title' => 'Delete'),

            	)

        	),

    	),

	),

));



and the value is 2.

Where is my mistake?:blink::unsure:

‘$model’ as such will give you the ‘search’ values.

The way you use it, you get the ‘$model’ values that existe before any search is started.

If you want to read the values corresponding the model for the given line, you need to do "$data->status" between quotes - Yii will evaluate the string as an expression when it generates the grid.

Thank you.

That was really worked.:)