I have a CGridView with an EditableColumn with a dropdown select defined like this:
array(
'name' => 'Id_department',
'header'=> 'Department',
'value' => '$data->Id_department ? Department::model()->findByPk($data->Id_department)->getConcatened() : "[click to edit]"',
'class' => 'editable.EditableColumn',
'editable' => array(
'type' => 'select',
'model' => new Employee(),
'url' => $this->createUrl('employee/update'),
'source' => $this->createUrl('department/getDepartments'),
'params' => array('YII_CSRF_TOKEN' => Yii::app()->request->csrfToken),
),
);
with this action in the controller:
public function actionGetDepartments(){
$models = Department::model->findAll();
echo CJSON::encode(Editable::source($models, 'Id_department', 'Name'));
Yii::app()->end();
}
This code builds the dropdown select with the Name attribute as the literal the user see on each option.
The think is that I have to show various attributes, not only one, so I tried to put a function call to a function that concatenates that fields in a single String in the source() function, but it doesn't works:
Editable::source($models, 'Id_department', concatenate())
Is there any way to do this?