我是Yii的新手,我有以下代碼,'columns'=>array( 'id', 'name', 'email', array( 'name' => 'deleted', 'value' => $model->deleted == 1 ? 'Yes' : 'No', ),
我想顯示YES,如果從數據庫中刪除的字段等於1,否則顯示爲NO。 它一直給我一個PHP的通知:使用未定義的常量是。 在此先感謝。Yii自定義CGridView undefined常量
EDIT 我孔wedgit
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'users-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'id',
'name',
'email',
array(
'name' => 'deleted',
),
/*
'pass',
'salt',
'first',
'last',
'phone',
'attempts',
'locked',
'gender',
'birth',
'joined',
'updated',
'active',
'reset',
'permission',
'appress',
'deleted',
*/
array(
'class'=>'CButtonColumn',
'template'=>'{view}{ban}',
'buttons' => array(
'ban' => array
(
'label'=> 'Ban User',
'url'=>'Yii::app()->createUrl("users/delete", array("id"=>$data->id))' ,
'click'=>'function(){confirm("Are you sure you want to Ban this ?");}',
),
)
),
),
));
我想你應該使用[$的數據,而不是$模式(HTTP:// WWW。 yiiframework.com/doc/api/1.1/CDataColumn#value-detail),但仍然不能解釋你看到的錯誤信息 – ernie 2013-03-14 16:55:43