Dropdownlist Column In Cgridview

Hi,

I need a solution for getting the value from the dropdownlist in a CGridViewColumn to update a database table. The grid is not populated with a model but with a class which has a model also wrapped inside it with a few more properties. The value of properties is calculated using the model and then the data comes from the calculated values from this class.

The last column is a dropdownlist and on changing its value I want the data to be updated in the column. I have kept the primary key of the table also in the class as a property

Is there a way to do it?

Thanks in advance.

-Nishi

Here is my solution


<?php $this->widget('zii.widgets.grid.CGridView', array(

	'dataProvider'=>$dataProvider,

	'filter'=>$model,

	'columns'=>array(

		'business_pk',

		array(

            'name' => 'Name',

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

        ),

        array(

            'name' => 'Address',

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

        ),


		array(

            'name' => 'createtime',

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

        ),

        array(

            'name' => 'status',

            'type'=>'raw',

            'value' =>

            	'CHtml::dropDownList(

	            	"business_status",

	            	"",

	            	CHtml::listData(

	            		BusinessStatus::model()->findAll(),

	            		"business_status_pk",

	            		"status"

	            	),

	        		array(

	        			"business_status_pk"=>$data->business_status_fk,

	        			"class"=>"drop",

	        			"options"=>array($data->business_status_fk=>array("selected"=>"selected")),

	        		)

	        	)',

        ),

        

	),

));