Autocomplete is a text box that displays suggestions while a user types. This demo shows how to customize the Autocomplete component and handle value changes.
Use one of the following properties to supply data to the component:
Accepts a local data array.
The value property stores the selected item. You can use the same property to select an item programmatically, as shown in the "Disabled" Autocomplete component.
If the data source contains objects, you should specify the valueExpr property. It accepts a data field name that uniquely identifies each data object. In this demo, valueExpr is specified only for the "Custom Item Template and Data Source Usage" and "Custom Store and Search Options" components because other components are bound to arrays of primitive values.
When a user types the first character, Autocomplete displays suggestions. To increase the number of characters that triggers suggestions, use the minSearchLength property. You can also specify the time interval Autocomplete should wait before it displays suggestions. Assign this time interval in milliseconds to the searchTimeout property. See the "Custom Store and Search Options" Autocomplete component for an example.
In most cases, the data field that supplies Autocomplete with suggestions is the same data field that is used to search for the entered text. If you use two different fields, assign the field that supplies Autocomplete with suggestions to the valueExpr property and the field used to search to the searchExpr property. Note that searchExpr also accepts arrays if you want to search multiple fields.
You can specify the following properties to customize the Autocomplete component's appearance:
The text that is displayed when Autocomplete is empty.
Adds a Clear button that empties the Autocomplete value as shown in the "With Clear Button" Autocomplete component.
Disables the component.
Customizes the appearance of the Autocomplete suggestions. See the "Custom Item Template and Data Source Usage" component for an example.