这是我的代码:
array(
'name' => 'bug_status',
'type' => 'raw',
'value' => "CHtml::dropDownList('status', '', array('1' => 'Open' , '2' => 'Fixed' , '3' => 'Closed' , '4' => 'Re-Open' , '5' => 'Clarification'),
array(
'ajax' => array(
'type'=>'GET',
'data'=>array('status' => 'js:this.value'),
'dataType' => 'text',
'url'=> Yii::app()->createUrl('bugDetails/statuslevel',array('id' => 1)),
'success' => 'function(data){alert(data);}',
)))",
),
答案 0 :(得分:0)
您可以添加第四个参数htmloptions
。
echo CHtml::dropDownList($model, 'field_name',
$optionsArray,
array('id'=>'add_id_to_your_drop_down'));
答案 1 :(得分:0)
array(
'name' => 'bug_status',
'type' => 'raw',
'value' => function($data) {
// you can use $data->yourStatusId
// default - Closed(3).
return CHtml::dropDownList('status', 3/*active id*/, array('1' => 'Open' , '2' => 'Fixed' , '3' => 'Closed' , '4' => 'Re-Open' , '5' => 'Clarification'));
}
//..
),