I'm using the TypeAhead widget from kartik for Yii2 (http://demos.krajee.com/widgets#typeahead-basic). I put all code like an example, but it doesn't work. What's wrong? In the same page, I used also the FileInput widget (http://demos.krajee.com/widget-details/fileinput) and it works fine
In resumen, I have:
use kartik\typeahead\TypeaheadBasic;
$data = ['Alabama', 'Alaska', 'Arizona', 'Arkansas'];
<link href="/vendor/kartik-v/yii2-widget-typeahead/assets/css/typeahead.min.css" media="all" rel="stylesheet" type="text/css"/>
<script src="/vendor/kartik-v/yii2-widget-typeahead/assets/js/typeahead.jquery.min.js" type="text/javascript"></script>
<?= $form->field($model, 'field')->widget(TypeaheadBasic::classname(), [
'data' => $data,
'pluginOptions' => ['highlight' => true],
'options' => ['placeholder' => 'Filter as you type ...'],
])->label('Label') ?>
Could be you need a dataset this way
<?= $form->field($model, 'field')->widget(TypeaheadBasic::classname(), [
//'data' => $data,
'pluginOptions' => ['highlight' => true],
'dataset' => [
[
'local' => $data,
'limit' => 10
]
],
'options' => ['placeholder' => 'Filter as you type ...'],
])->label('Label') ?>