\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->animation(true)

// Output it

echo $autoComplete->render();
?>

Methods

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 via the this keyword) 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 via the this keyword) 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 via the this keyword) 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 dataSource.

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);
?>

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 via the this keyword) 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);
?>

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

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() { }'));
?>

open

Fired when the suggestion popup of the widget is opened by the user.The event handler function context (available via the this keyword) 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');
?>

popup

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 ``

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(new array());
?>

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));
?>