How To Display Data From Checkboxlist In Cgridview

Hello…

please help me…

i have code model Cabang like this…


public function relations() {

		return array(

			'createBy' => array(self::BELONGS_TO, 'Users', 'create_by'),

			'updateBy' => array(self::BELONGS_TO, 'Users', 'update_by'),

                        'pilihanCabang' => array(self::HAS_ONE, 'Lookup', 'pilihan'),


		);

	}

and in my view


 array(  

                  'name'=>'pilihan',

                  'filter'=>CHtml::listData(Lookup::model()->findAll(),'id','name'),

                  'value'=>'$data->pilihanCabang->name',

                ),

and result show this : The relation "pilihanCabang" in active record class "Cabang" is specified with an invalid foreign key "pilihan". There is no such column in the table "lookup".

I have table “cabang” with ‘pilihan’ field with contain “1,2”

How to show data with relation table??

please see this

i hope it’s some help.

Show this message


 Array to string conversion 

:(

please post the code

model :


public function relations() {

		return array(

			'createBy' => array(self::BELONGS_TO, 'Users', 'create_by'),

			'updateBy' => array(self::BELONGS_TO, 'Users', 'update_by'),

                        'lookup' => array(self::BELONGS_TO, 'Lookup', 'pilihan'),

		);

	}

and my view :


               array(  

                  'name'=>'pilihan',

//                  'filter'=>CHtml::listData(Lookup::model()->findAll(),'id','name'),

                  'value'=>'$data->lookup->name',

                ),

I dont have relation in field “pilihan” with table lookup. Just look mysql dump… :)

thanks

Hi just try the


'value'=>'$data->lookup',

Hi also you can write the custome query on value filed.

like


 'value'=>'Users::Model()->FindByPk($data->user_id)->username',