Problem With Search/view Information

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(




'type'=&gt;'striped bordered condensed',




	     'name' =&gt; 'virtual_machine',

	     'value' =&gt; '(&#036;data-&gt;virtual_machine === 0) ? Yii::t(&#092;'app&#092;', &#092;'No&#092;') : Yii::t(&#092;'app&#092;', &#092;'Yes&#092;')',

	     'filter' =&gt; array('0' =&gt; Yii::t('app', 'No'), '1' =&gt; Yii::t('app', 'Yes')),







)); ?>

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'=&gt;true),

		array('note', 'safe'),

		array('id, virtual_machine, note', 'safe', 'on'=&gt;'search'),



Can anyone explain what is wrong?


Dear Friend,

Kindly check whether the following is helpful.

Replace the identical(===) operator with equal(==) operator.


'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')),


you can change it other way around swap your values and see something as following

 'filter'=>array(1=>'Yes', 0=>'No'),

 'value'=>'($data->virtual_machine==1)?("Yes")<img src='' class='bbc_emoticon' alt=':(' />"No")',

also check your database if your data is getting saved

Replaced the === with == and that fixed the problem.

Thank you