Class yii\jui\AutoComplete

Inheritanceyii\jui\AutoComplete » yii\jui\InputWidget » yii\jui\Widget » yii\base\Widget
Available since version2.0

AutoComplete renders an autocomplete jQuery UI widget.

For example:

echo AutoComplete::widget([
    'model' => $model,
    'attribute' => 'country',
    'clientOptions' => [
        'source' => ['USA', 'RUS'],
    ],
]);

The following example will use the name property instead:

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

You can also use this widget in an \yii\jui\yii\widgets\ActiveForm using the \yii\jui\yii\widgets\ActiveField::widget() method, for example like this:

<?= $form->field($model, 'from_date')->widget(\yii\jui\AutoComplete::classname(), [
    'clientOptions' => [
        'source' => ['USA', 'RUS'],
    ],
]) ?>

See also http://api.jqueryui.com/autocomplete/.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$attribute string The model attribute that this widget is associated with. yii\jui\InputWidget
$clientEvents array The event handlers for the underlying jQuery UI widget. yii\jui\Widget
$clientOptions array The options for the underlying jQuery UI widget. yii\jui\Widget
$model \yii\base\Model The data model that this widget is associated with. yii\jui\InputWidget
$name string The input name. yii\jui\InputWidget
$options array The HTML attributes for the widget container tag. yii\jui\Widget
$value string The input value. yii\jui\InputWidget

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$clientEventMap array Event names mapped to what should be specified in `. yii\jui\Widget

Public Methods

Hide inherited methods

MethodDescriptionDefined By
init() Initializes the widget. yii\jui\InputWidget
renderWidget() Renders the AutoComplete widget. yii\jui\AutoComplete
run() yii\jui\AutoComplete

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
hasModel() yii\jui\InputWidget
registerClientEvents() Registers a specific jQuery UI widget events yii\jui\Widget
registerClientOptions() Registers a specific jQuery UI widget options yii\jui\Widget
registerWidget() Registers a specific jQuery UI widget asset bundle, initializes it with client options and registers related events yii\jui\Widget

Method Details

renderWidget() public method

Renders the AutoComplete widget.

public string renderWidget ( )
return string

The rendering result.

run() public method

public void run ( )