[Solved] i have a problem with CGridView

it’s my code (gii’s code) ::)




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

	'id'=>'comment-grid',

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

	'filter'=>$model,

	'columns'=>array(

		'id',

		'name',

		'email',

		'website',

		'content',

        'status',

		array(

		  'dataField'=>'status',

		  'dataExpression'=>'($model->status==1) ? "fgi":"sdfsdf"',

		),

		/*

		'post_id',

		*/

		array(

			'class'=>'CButtonColumn',

		),

	),

)); ?>



i just added this line


		array(

		  'dataField'=>'status',

		  'dataExpression'=>'($model->status==1) ? "fgi":"sdfsdf"',

		),

but when i run script, i get this error

[color="#FF0000"]Property "CDataColumn.dataField" is not defined.[/color]

have you checked the documentation for CDataColumn… there is no dataField or dataExpression… but there are name and value that you can use…

Check here - http://www.yiiframework.com/doc/api/CDataColumn

i have used Yii v1.1rc Class Reference

and there was dataField but i changed dataField to name and it’s working

tnx