\Kendo\UI\AutoComplete

A PHP wrapper for Kendo UI AutoComplete.

Inherits from \Kendo\UI\Widget.

Usage

To use AutoComplete in a PHP page instantiate a new instance, configure it via the available configuration methods and output it by echo-ing the result of the render method.

Using Kendo AutoComplete

<?php
// Create a new instance of AutoComplete and specify its id
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');

// Configure it
$autoComplete->adaptiveMode('value')

// Output it

echo $autoComplete->render();
?>

Methods

adaptiveMode

Specifies the adaptive rendering of the component. The supported values are: none (default), auto.

Returns

\Kendo\UI\AutoComplete

Parameters

$value string

Example

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->adaptiveMode('value');
?>

animation

Configures the opening and closing animations of the suggestion popup. Setting the animation option to false will disable the opening and closing animations. As a result the suggestion popup will open and close instantly. is not a valid configuration.

Returns

\Kendo\UI\AutoComplete

Parameters

$value boolean|\Kendo\UI\AutoCompleteAnimation|array

Example - using boolean

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->animation(true);
?>

Example - using \Kendo\UI\AutoCompleteAnimation

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$animation = new \Kendo\UI\AutoCompleteAnimation();
$close = new \Kendo\UI\AutoCompleteAnimationClose();
$animation->close($close);
$autoComplete->animation($animation);
?>

Example - using array

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$close = new \Kendo\UI\AutoCompleteAnimationClose();
$autoComplete->animation(array('close' => $close));
?>

autoWidth

If set to true, the widget automatically adjusts the width of the popup element and does not wrap up the item label.

Returns

\Kendo\UI\AutoComplete

Parameters

$value boolean

Example

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->autoWidth(true);
?>

change

Fired when the value of the widget is changed by the user.The event handler function context (available through the keyword this) will be set to the widget instance. For additional information check the change event documentation.

Returns

\Kendo\UI\AutoComplete

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->change('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onChange(e) {
        // handle the change event.
    }
</script>
<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->change('onChange');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->change(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

clearButton

Unless this options is set to false, a button will appear when hovering the widget. Clicking that button will reset the widget's value and will trigger the change event.

Returns

\Kendo\UI\AutoComplete

Parameters

$value boolean

Example

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->clearButton(true);
?>

close

Fired when the suggestion popup of the widget is closed by the user.The event handler function context (available through the keyword this) will be set to the widget instance. For additional information check the close event documentation.

Returns

\Kendo\UI\AutoComplete

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->close('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onClose(e) {
        // handle the close event.
    }
</script>
<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->close('onClose');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->close(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

dataBound

Fired when the widget is bound to data from its data source.The event handler function context (available through the keyword this) will be set to the widget instance. For additional information check the dataBound event documentation.

Returns

\Kendo\UI\AutoComplete

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->dataBound('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onDataBound(e) {
        // handle the dataBound event.
    }
</script>
<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->dataBound('onDataBound');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->dataBound(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

dataSource

Sets the data source of the widget.

Returns

\Kendo\UI\AutoComplete

Parameters

$value \Kendo\Data\DataSource|array

Example - using \Kendo\Data\DataSource

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$dataSource = new \Kendo\Data\DataSource();
$autoComplete->dataSource($dataSource);
?>

Example - using array

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$schema = new \Kendo\Data\DataSourceSchema();
$autoComplete->dataSource(array('schema' => $schema));
?>

dataTextField

The field of the data item used when searching for suggestions. This is the text that will be displayed in the list of matched results.

Returns

\Kendo\UI\AutoComplete

Parameters

$value string

Example

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->dataTextField('value');
?>

delay

The delay in milliseconds between a keystroke and when the widget displays the suggestion popup.

Returns

\Kendo\UI\AutoComplete

Parameters

$value float

Example

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->delay(1);
?>

enable

If set to false the widget will be disabled and will not allow user input. The widget is enabled by default and allows user input.

Returns

\Kendo\UI\AutoComplete

Parameters

$value boolean

Example

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->enable(true);
?>

enforceMinLength

If set to true the widget will not show all items when the text of the search input cleared. By default the widget shows all items when the text of the search input is cleared. Works in conjunction with minLength.

Returns

\Kendo\UI\AutoComplete

Parameters

$value boolean

Example

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->enforceMinLength(true);
?>

fillMode

Sets a value controlling how the color is applied. Can also be set to the following string values: "none"; "solid"; "flat" or "outline".

Returns

\Kendo\UI\AutoComplete

Parameters

$value string

Example

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->fillMode('value');
?>

filter

The filtering method used to determine the suggestions for the current value. The default filter is "startswith" - all data items which begin with the current widget value are displayed in the suggestion popup. The supported filter values are startswith, endswith and contains.

Returns

\Kendo\UI\AutoComplete

Parameters

$value string

Example

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->filter('value');
?>

filtering

Fired when the widget is about to filter the data source.The event handler function context (available through the keyword this) will be set to the widget instance. For additional information check the filtering event documentation.

Returns

\Kendo\UI\AutoComplete

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->filtering('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onFiltering(e) {
        // handle the filtering event.
    }
</script>
<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->filtering('onFiltering');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->filtering(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

fixedGroupTemplate

The template used to render the fixed header group. By default the widget displays only the value of the current group.

Returns

\Kendo\UI\AutoComplete

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->fixedGroupTemplate('value');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->fixedGroupTemplate(new \Kendo\JavaScriptFunction('function() { }'));
?>

footerTemplate

The template used to render the footer template. The footer template receives the widget itself as a part of the data argument. Use the widget fields directly in the template.

Returns

\Kendo\UI\AutoComplete

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->footerTemplate('value');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->footerTemplate(new \Kendo\JavaScriptFunction('function() { }'));
?>

groupTemplate

The template used to render the groups. By default the widget displays only the value of the group.

Returns

\Kendo\UI\AutoComplete

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->groupTemplate('value');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->groupTemplate(new \Kendo\JavaScriptFunction('function() { }'));
?>

headerTemplate

Specifies a static HTML content, which will be rendered as a header of the popup element.

Returns

\Kendo\UI\AutoComplete

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->headerTemplate('value');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->headerTemplate(new \Kendo\JavaScriptFunction('function() { }'));
?>

height

The height of the suggestion popup in pixels. The default value is 200 pixels.

Returns

\Kendo\UI\AutoComplete

Parameters

$value float

Example

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->height(1);
?>

highlightFirst

If set to true the first suggestion will be automatically highlighted.

Returns

\Kendo\UI\AutoComplete

Parameters

$value boolean

Example

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->highlightFirst(true);
?>

ignoreCase

If set to false case-sensitive search will be performed to find suggestions. The widget performs case-insensitive searching by default.

Returns

\Kendo\UI\AutoComplete

Parameters

$value boolean

Example

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->ignoreCase(true);
?>

label

Adds a label before the input. If the input has no id attribute, a generated id will be assigned. The string and the function parameters are setting the inner HTML of the label.

Returns

\Kendo\UI\AutoComplete

Parameters

$value string|\Kendo\JavaScriptFunction|\Kendo\UI\AutoCompleteLabel|array

Example - using string

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->label('value');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->label(new \Kendo\JavaScriptFunction('function() { }'));
?>

Example - using \Kendo\UI\AutoCompleteLabel

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$label = new \Kendo\UI\AutoCompleteLabel();
$content = 'value';
$label->content($content);
$autoComplete->label($label);
?>

Example - using array

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$content = 'value';
$autoComplete->label(array('content' => $content));
?>

messages

The text messages displayed in the widget. Use this option to customize or localize the messages.

Returns

\Kendo\UI\AutoComplete

Parameters

$value \Kendo\UI\AutoCompleteMessages|array

Example - using \Kendo\UI\AutoCompleteMessages

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$messages = new \Kendo\UI\AutoCompleteMessages();
$clear = 'value';
$messages->clear($clear);
$autoComplete->messages($messages);
?>

Example - using array

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$clear = 'value';
$autoComplete->messages(array('clear' => $clear));
?>

minLength

The minimum number of characters the user must type before a search is performed. Set to higher value than 1 if the search could match a lot of items.

Returns

\Kendo\UI\AutoComplete

Parameters

$value float

Example

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->minLength(1);
?>

noDataTemplate

The template used to render the "no data" template, which will be displayed if no results are found or the underlying data source is empty. The noData template receives the widget itself as a part of the data argument. The template will be evaluated on every widget data bound.

Returns

\Kendo\UI\AutoComplete

Parameters

$value string|\Kendo\JavaScriptFunction|boolean

Example - using string

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->noDataTemplate('value');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->noDataTemplate(new \Kendo\JavaScriptFunction('function() { }'));
?>

Example - using boolean

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->noDataTemplate(true);
?>

open

Fired when the suggestion popup of the widget is opened by the user.The event handler function context (available through the keyword this) will be set to the widget instance. For additional information check the open event documentation.

Returns

\Kendo\UI\AutoComplete

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->open('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onOpen(e) {
        // handle the open event.
    }
</script>
<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->open('onOpen');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->open(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

placeholder

The hint displayed by the widget when it is empty. Not set by default.

Returns

\Kendo\UI\AutoComplete

Parameters

$value string

Example

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->placeholder('value');
?>

The options that will be used for the popup initialization. For more details about the available options refer to Popup documentation.

Returns

\Kendo\UI\AutoComplete

Parameters

$value ``

prefixOptions

The configuration for the prefix adornment of the component.

Returns

\Kendo\UI\AutoComplete

Parameters

$value \Kendo\UI\AutoCompletePrefixOptions|array

Example - using \Kendo\UI\AutoCompletePrefixOptions

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$prefixOptions = new \Kendo\UI\AutoCompletePrefixOptions();
$icon = 'value';
$prefixOptions->icon($icon);
$autoComplete->prefixOptions($prefixOptions);
?>

Example - using array

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$icon = 'value';
$autoComplete->prefixOptions(array('icon' => $icon));
?>

rounded

Sets a value controlling the border radius. Can also be set to the following string values: "none"; "small"; "medium"; "large" or "full".

Returns

\Kendo\UI\AutoComplete

Parameters

$value string

Example

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->rounded('value');
?>

select

Fired when an item from the suggestion popup is selected by the user. For additional information check the select event documentation.

Returns

\Kendo\UI\AutoComplete

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->select('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onSelect(e) {
        // handle the select event.
    }
</script>
<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->select('onSelect');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->select(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

separator

The character used to separate multiple values. Empty by default.

Returns

\Kendo\UI\AutoComplete

Parameters

$value string|array

Example - using string

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->separator('value');
?>

Example - using array

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->separator(array());
?>

size

Sets a value controlling size of the component. Can also be set to the following string values: "small"; "medium"; "large" or "none".

Returns

\Kendo\UI\AutoComplete

Parameters

$value string

Example

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->size('value');
?>

suffixOptions

The configuration for the suffix adornment of the component.

Returns

\Kendo\UI\AutoComplete

Parameters

$value \Kendo\UI\AutoCompleteSuffixOptions|array

Example - using \Kendo\UI\AutoCompleteSuffixOptions

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$suffixOptions = new \Kendo\UI\AutoCompleteSuffixOptions();
$icon = 'value';
$suffixOptions->icon($icon);
$autoComplete->suffixOptions($suffixOptions);
?>

Example - using array

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$icon = 'value';
$autoComplete->suffixOptions(array('icon' => $icon));
?>

suggest

If set to true the widget will automatically use the first suggestion as its value.

Returns

\Kendo\UI\AutoComplete

Parameters

$value boolean

Example

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->suggest(true);
?>

template

The template used to render the suggestions. By default the widget displays only the text of the suggestion (configured via dataTextField).

Returns

\Kendo\UI\AutoComplete

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->template('value');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->template(new \Kendo\JavaScriptFunction('function() { }'));
?>

value

The value of the widget.

Returns

\Kendo\UI\AutoComplete

Parameters

$value string

Example

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->value('value');
?>

valuePrimitive

Specifies the value binding behavior for the widget when the initial model value is null. If set to true, the View-Model field will be updated with the selected item text field. If set to false, the View-Model field will be updated with the selected item.

Returns

\Kendo\UI\AutoComplete

Parameters

$value boolean

Example

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->valuePrimitive(true);
?>

virtual

Enables the virtualization feature of the widget. The configuration can be set on an object, which contains two properties - itemHeight and valueMapper.For detailed information, refer to the article on virtualization.

Returns

\Kendo\UI\AutoComplete

Parameters

$value boolean|\Kendo\UI\AutoCompleteVirtual|array

Example - using boolean

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$autoComplete->virtual(true);
?>

Example - using \Kendo\UI\AutoCompleteVirtual

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$virtual = new \Kendo\UI\AutoCompleteVirtual();
$itemHeight = 1;
$virtual->itemHeight($itemHeight);
$autoComplete->virtual($virtual);
?>

Example - using array

<?php
$autoComplete = new \Kendo\UI\AutoComplete('AutoComplete');
$itemHeight = 1;
$autoComplete->virtual(array('itemHeight' => $itemHeight));
?>
In this article
Not finding the help you need?