2017-11-19 6 views
0

をDropDownListコントロールするために私はこのようなドロップダウンリストを作成しました: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からオートコンプリートを使用しました。 2自体:コントローラで

:私のview.php

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'=>'بحث باسم المريض', 
      ], 
     ]); 

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