Drop down menu 无法在yii中获取ESelect2扩展名在下拉列表中连接两个或更多列
Eselect2是am使用的扩展,myADropDown()获取数据并显示,但我需要在下拉列表中连接两列或更多列 模型1视图Drop down menu 无法在yii中获取ESelect2扩展名在下拉列表中连接两个或更多列,drop-down-menu,yii,html-select,yii-extensions,Drop Down Menu,Yii,Html Select,Yii Extensions,Eselect2是am使用的扩展,myADropDown()获取数据并显示,但我需要在下拉列表中连接两列或更多列 模型1视图 <?php $this->widget('ext.select2.ESelect2', array( 'name' => 'id', 'model' => $model, 'options' => array( 'placeholder' => $model->getAttributeLab
<?php $this->widget('ext.select2.ESelect2', array(
'name' => 'id',
'model' => $model,
'options' => array(
'placeholder' => $model->getAttributeLabel('id'),
),
'data' => $model->myADropDown(),
));?>
//id在另一个tbl中为fk
在下拉列表中,我需要的是每个人的姓名、位置和评级,我无法做到这一点
请告诉我如何实现它对于listdata中的表字段,请检查此Yii论坛答案: 根据链接建议,您需要在模型中添加一个函数以获得连接的字符串
public function __get($key){
$action = 'get'.str_replace(' ','',ucwords(str_replace('_',' ',$key)));
if(method_exists($this, $action)) return $this->$action();
return parent::__get($key);
}
不,它不工作,以及我使用eselect2作为扩展,我需要它的问题与eselect2。您正在从listdata准备数据。所以,您只需要在模型中工作。不在eselect中。
public function __get($key){
$action = 'get'.str_replace(' ','',ucwords(str_replace('_',' ',$key)));
if(method_exists($this, $action)) return $this->$action();
return parent::__get($key);
}