I am new to yii and I have a screen that displays all columns in a table. One of the columns is defined as boolean. When the screen is displayed the boolean column always display "Yes". Even when the search feature is selected it lists the correct number of rows but the colum displays "Yes".
Here is the code in the view admin file:
<?php $this->widget(‘bootstrap.widgets.TbGridView’,array(
'id'=>'server-grid',
'dataProvider'=>$gridDataProvider,
'filter'=>$model,
'type'=>'striped bordered condensed',
'columns'=>array(
'id',
array(
'name' => 'virtual_machine',
'value' => '($data->virtual_machine === 0) ? Yii::t(\'app\', \'No\') : Yii::t(\'app\', \'Yes\')',
'filter' => array('0' => Yii::t('app', 'No'), '1' => Yii::t('app', 'Yes')),
),
'note',
array(
'class'=>'bootstrap.widgets.TbButtonColumn',
),
),
)); ?>
The model file under rules defines the virtual_machine as integerOnly… this code is generated should this not be boolean?
model code:
public function rules() {
return array(
array('virtual_machine', 'required'),
array('virtual_machine, 'numerical', 'integerOnly'=>true),
array('note', 'safe'),
array('id, virtual_machine, note', 'safe', 'on'=>'search'),
);
}
Can anyone explain what is wrong?
Thanks