yiicgridviewcactivedataprovider

Process in CActiveDataProvider or CGridView


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

Solution

  • Try this code:

    In views admin.php

    array(
        'name'=>'IsMetro',
        'value'=>'$data->IsMetro=="1"?"TRUE":"FALSE"',
          ),