2017-11-19 11 views
0

난했습니다과 같이 드롭 다운리스트 작성 :YII2 광고 html 태그는 드롭 다운리스트하는

<?= $form->field($model, 'doctor_id')->widget(select2::className(),[ 
    'data'=> arrayhelper::map(\app\models\doctors::find()->asArray()->all(),'doctor_id', 
     function($model, $defaultValue) { 
      return $model['doctor_name'].' | '. $model['doctor_id'].' | '. $model['phone1'] ; 
}), 
// 'languge'=>'en', 
    'options'=>['placeholder'=>'... إختر اسم الطبيب','class' => 'yuorClass'], 
    'pluginOptions'=>[ 
    'allowClear'=>true 
    ], 
    ])?> 

그래서 내가 여기

의 사진으로이 $model['doctor_name'].' - '. $model['doctor_id'].' <br> '. $model['phone1'] ;

처럼 <br>처럼 행 사이에 HTML 태그를 추가해야

enter image description here

답변

0

나는 찾고있는 것을 찾지 못했고, 나는 나의 생각을 바꿨다 : 나는 YII에서 자동 완성을 사용했다. 이 자체를 : 컨트롤러에

: 내 view.php에서

$patients = patient::find()->select(['concat(patient_id) as value',' concat("(",patient_id,") ","(",mobile,") ",patient_name) as label','patient_id as id'])->asArray()->all(); 

use yii\jui\AutoComplete; 
use yii\web\JsExpression; 


echo AutoComplete::widget([ 
      'class'=> 'form-control', 
      'clientOptions' => [ 
      'class'=> 'form-control', 
      'source' => $patients, 
      'minLength'=>'1', 
      'autoFill'=>true, 
      'select' => new JsExpression("function(event, ui) { 
          $('#memberssearch-family_name_id').val(ui.item.id); 
          document.location = '?r=patient1/view&id='+ui.item.id; 
         }")], 
         'options'=>[ 
            'class'=>'form-control', 
            'placeholder'=>'بحث باسم المريض', 
      ], 
     ]);