I have two fields in a model that are Boolean datatype.
Strangely enough, CGridView displayed always as ‘Yes’, that is, as ‘true’ (it was autogenerated with Giix).
In my favour, saying that CDetailView shows the correct output: ‘Yes’ or ‘No’ depending on the numerical values respectively ‘1’ or ‘0’ (true, false).
In my case, I use MySql database. The Booleans in MySql are built with TINYINT (1) and, in fact, Yii recognize correctly these, as Booleans, but not CGridView.
My question is: Is normal? Do I need to do some change?
According to the documentation for the column property of Cgridview:
When a column is specified as a string, it should be in the format of "name:type:header", where "type" and "header" are optional. A CDataColumn instance will be created in this case, whose CDataColumn::name, CDataColumn::type and CDataColumn::header properties will be initialized accordingly.
The default for the type property is Text. Try specifying the type as "boolean".