想顯示用戶清單,mail.Here這是我的代碼,但沒有任何反應Yii2自動完成沒有任何反應
<?php
$data = Users::find()
->select(['user_email as value', 'user_id as id'])
->asArray()
->all();
echo AutoComplete::widget([
'name' => 'user_email',
'id' => 'ddd',
'clientOptions' => [
'source' => $data,
'autoFill'=>true,
'minLength'=>'1',
'select' => new JsExpression("function(event, ui) {
$('#user_mail_1').val(ui.item.id);
}")],
]);
?>
<?= $form->field($model, 'user_email')->HiddenInput(['id' => 'user_mail_1'])->label(false) ?>
檢查瀏覽器控制檯。 –