1

I have a table called City, table contain field IsMetro it is bit(1), so it can store 1 or 0, i have generated model for this table and generated CRUD operation forms.

Now i want True instead of 1 and False instead of 0.

Where should i perform this operation in CActiveDataProvider or CGridView and how to do this

i am getting this output

CityId - City Name - IsMetro-(bit(1))
1        A           1

i want this output

CityId - City Name - IsMetro-(bit(1))
1        A           True
Hitesh Modha
  • 2,740
  • 5
  • 28
  • 47

2 Answers2

1

Try this code:

In views admin.php

array(
    'name'=>'IsMetro',
    'value'=>'$data->IsMetro=="1"?"TRUE":"FALSE"',
      ),
Kumar V
  • 8,810
  • 9
  • 39
  • 58
1

You can do this in CGridView column by using the property value. In you column you can write like this

 array(

            'header' => 'IsMetro',
            'htmlOptions' => array('style' => 'text-align:center;'),
            'value'=>'($data->IsMetro==1)?"True":"False"',
        ),
Rafay Zia Mir
  • 2,116
  • 6
  • 23
  • 49