I’ve been trying to specify a CGridView column that would dynamically display (and allow changing of) a value from the recordset. I’ve tried several ways to specify that the radio button list is tied to the data model, but none of them seem to work. Here’s the best column specification I have:
array(
'header' => 'Timeliness',
'type' => 'raw',
'value' => "CHtml::activeRadioButtonList($data,'Lease_Action_id',array('1'=>'OK','2'=>'Late','3'=>'Very Late'),array(
'labelOptions'=>array('style'=>'display:inline'), // add this code
'separator'=>'',
))",
),
In the column I get this:
If I put quotes around the $data variable like this:
array(
'header' => 'Timeliness',
'type' => 'raw',
'value' => "CHtml::activeRadioButtonList('$data','Lease_Action_id',array('1'=>'OK','2'=>'Late','3'=>'Very Late'),array(
'labelOptions'=>array('style'=>'display:inline'), // add this code
'separator'=>'',
))",
),
(which doesn’t make any sense, but I’m trying anything), I get this, which seems clear enough:
But I thought that specifying $data for parameter 1 would pass an object. When I try specifying the dataprovider object for parameter 1 it does parse it correctly as an object, and it throws a different error:
To me that just says that $data ought to work. Or is that not the right name for the row’s data object?
Can anyone help, please? I’ve searched high and low and haven’t found anything at all about binding either a radiobuttonlist or a dropdownlist to a data value in a gridview. Is it possible?
Thanks.