CGridView Problem

Hi,

i will show an image in a CGridView Column based on a field.

This will show me different utf-8 symbols depending on the job_active column.


array(

                'name' => 'job_active',

                'value' => '($data->job_active === TRUE) ? "✔" : "✗"', // output CHECK MARK or X

                'htmlOptions' => array('style' => 'text-align: center;'),

            ),

but this does not work on IE6.

now i tested different methods to solve this problem. But nothing worked.


array(

                'name' => 'job_active',

                'value' => '($data->job_active === TRUE) ? CHtml::image('check.png') : CHtml::image('error.png'), // output CHECK MARK or X

                'htmlOptions' => array('style' => 'text-align: center;'),

            ),

this will ouput encoded html chars -> no nimage shows, just text :confused:


array(

                'class' => 'CButtonColumn',

                'header' => 'Active', 

                'template' => '{btnActive} {btnInactive}',

                'buttons' => array(

                    'btnActive' => array(

                        'label' => 'Active',

                        'imageUrl' => Yii::app()->baseUrl . '/images/symbols/check_16x16.png',

                        'visible' => ($data->job_active === TRUE) ? TRUE : FALSE,

                    ),

                    'btnInactive' => array(

                        'label' => 'Inactive',

                        'imageUrl' => Yii::app()->baseUrl . '/images/symbols/error_16x16.png',

                        'visible' => ($data->job_active === TRUE) ? TRUE : FALSE,

                    ),

                ),

            ),

this throws an error:

any ideas?

thx

For the CHtml::image version… check the type attribute of the CDataColumn - http://www.yiiframework.com/doc/api/CDataColumn#type-detail

perfect. that worked. thanks :)

my code for other people :D


array(

                'class' => 'CDataColumn',

                'type' => 'html',

                'name' => 'job_active',

                'value' => '($data->job_active === TRUE) ? CHtml::image("check.png") : CHtml::image("error.png")',

                'htmlOptions' => array('style' => 'text-align: center;'),

            ),