Chhorn Soro
Chhorn Soro

Reputation: 3151

Where is the Yii2 autocomplete class located?

I have used:

echo AutoComplete::widget([
    'name' => 'file',
        'clientOptions' => [
        'source' => ['USA', 'RUS'],
    ],
]);

But I get the error:

Class 'AutoComplete' not found.

Upvotes: 3

Views: 3516

Answers (1)

arogachev
arogachev

Reputation: 33538

You should install Yii 2 Jquery UI extension first. The full class name with namespace is yii\jui\Autocomplete. You can use it like this:

use yii\jui\Autocomplete;

...

echo AutoComplete::widget([
    'name' => 'file',
    'clientOptions' => [
        'source' => ['USA', 'RUS'],
    ],
]);

or

echo yii\jui\AutoComplete::widget([
    'name' => 'file',
    'clientOptions' => [
        'source' => ['USA', 'RUS'],
    ],
]);

Upvotes: 5

Related Questions