Interface for a class AutoComplete
EmitType<Object>
Triggers before fetching data from the remote server.
EmitType<Object>
Triggers after data is fetched successfully from the remote server.
EmitType<Object>
Triggers when the data fetch request from the remote server fails.
EmitType<Object>
Triggers when the popup before opens.
EmitType<Object>
Triggers when focus moves out from the component.
Triggers when an item in a popup is selected or when the model value is changed by user.
Use change event to
Configure the Cascading DropDownList
Triggers when the popup is closed.
EmitType<Object>
Triggers when the component is created.
EmitType<CustomValueSpecifierEventArgs>
Triggers on set a
custom value
to this component.
EmitType<Object>
Triggers when data source is populated in the popup list..
EmitType<Object>
Triggers when the component is destroyed.
Triggers on typing a character in the component.
EmitType<Object>
Triggers when the component is focused.
Triggers when the popup opens.
EmitType<Object>
Triggers when the user starts resizing the DropDown popup.
EmitType<Object>
Triggers when the user finishes resizing the DropDown popup.
EmitType<Object>
Triggers continuously while the DropDown popup is being resized by the user. This event provides live updates on the width and height of the popup.
Triggers when an item in the popup is selected by the user either with mouse/tap or with keyboard navigation.
string
| Function
Accepts the template and assigns it to the popup list content of the component when the data fetch request from the remote server fails.
boolean
Specifies whether the component allows user defined value which does not exist in data source.
boolean
Defines whether the object binding is allowed or not in the component.
boolean
Gets or sets a value that indicates whether the DropDownList popup can be resized.
When set to true
, a resize handle appears in the bottom-right corner of the popup,
allowing the user to resize the width and height of the popup.
boolean
Specifies whether suggest a first matched item in input when searching. No action happens when no matches found.
string
Sets CSS classes to the root element of the component that allows customization of appearance.
{ : }
[]
| DataManager
| string[]
| number[]
| boolean[]
Accepts the list items either through local or remote service and binds it to the component.
It can be an array of JSON Objects or an instance of
DataManager
.
boolean
Enable or disable persisting component’s state between page reloads. If enabled, following list of states will be persisted.
boolean
Enable or disable rendering component in right to left direction.
boolean
Defines whether to enable virtual scrolling in the component.
boolean
Specifies a value that indicates whether the component is enabled or not.
The fields
property maps the columns of the data table and binds the data to the component.
<input type="text" id="country">
import { AutoComplete } from '@syncfusion/ej2-dropdowns';
let countries: { [key: string]: Object; }[] = [
{ Name: "Australia", Code: "AU" },
{ Name: "Bermuda", Code: "BM" },
{ Name: "Canada", Code: "CA" },
{ Name: "Cameroon", Code: "CM" },
{ Name: "Denmark", Code: "DK" }
];
// initialize AutoComplete component
let atcObj2: AutoComplete = new AutoComplete({
//set the local data to dataSource property
dataSource: countries,
// map the appropriate columns to fields property
fields: { value: 'Name' },
// set the placeholder to AutoComplete input element
placeholder: 'e.g. Australia'
});
atcObj2.appendTo('#country');
For more details about the field mapping refer to
Data binding
documentation.
Determines on which filter type, the component needs to be considered on search action.
The available FilterType
and its supported data types are
FilterType |
Description |
Supported Types |
StartsWith |
Checks whether a value begins with the specified value. |
String |
EndsWith |
Checks whether a value ends with specified value. |
String |
Contains |
Checks whether a value contains with specified value. |
String |
The default value set to Contains
, all the suggestion items which contain typed characters to listed in the suggestion popup.
FloatLabelType
Specifies whether to display the floating label above the input element. Possible values are:
string
| Function
Accepts the template design and assigns it to the footer container of the popup list.
For more details about the available template options refer to
Template
documentation.
string
| Function
Accepts the template design and assigns it to the group headers present in the popup list.
string
| Function
Accepts the template design and assigns it to the header container of the popup list.
For more details about the available template options refer to
Template
documentation.
boolean
When set to ‘true’, highlight the searched characters on suggested list items.
For more details about the highlight refer to
Custom highlight search
documentation.
{ : }
Allows additional HTML attributes such as title, name, etc., and accepts n number of attributes in a key-value pair format.
<input type="text" id="country">
import { AutoComplete } from '@syncfusion/ej2-dropdowns';
let countries: { [key: string]: Object; }[] = [
{ Name: "Australia", Code: "AU" },
{ Name: "Bermuda", Code: "BM" },
{ Name: "Canada", Code: "CA" },
{ Name: "Cameroon", Code: "CM" },
{ Name: "Denmark", Code: "DK" }
];
// initialize AutoComplete component
let autocomplete: AutoComplete = new AutoComplete({
//set the local data to dataSource property
dataSource: countries,
// map the appropriate columns to fields property
fields: { value: 'Name' },
// set the placeholder to AutoComplete input element
placeholder: 'e.g. Australia',
htmlAttributes: { name: "country", maxlength: "2", title: "AutoComplete" }
});
autocomplete.appendTo('#country');
boolean
ignoreAccent set to true, then ignores the diacritic characters or accents when filtering.
boolean
When set to ‘false’, consider the case-sensitive
on performing the search to find suggestions.
By default consider the casing.
boolean
Defines whether the popup opens in fullscreen mode on mobile devices when filtering is enabled. When set to false, the popup will display similarly on both mobile and desktop devices.
string
| Function
Accepts the template design and assigns it to each list item present in the popup.
We have built-in template engine
which provides options to compile template string into a executable function.
For EX: We have expression evolution as like ES6 expression string literals.
string
Overrides the global culture and localization value for this component. Default global culture is ‘en-US’.
number
Allows you to set [`the minimum search character length’] (../../auto-complete/filtering#limit-the-minimum-filter-character), the search action will perform after typed minimum characters.
string
| Function
Accepts the template design and assigns it to popup list of component when no data is available on the component.
string
Specifies a short hint that describes the expected value of the DropDownList component.
string
| number
Specifies the height of the popup list.
For more details about the popup configuration refer to
Popup Configuration
documentation.
string
| number
Specifies the width of the popup list. By default, the popup width sets based on the width of the component.
For more details about the popup configuration refer to
Popup Configuration
documentation.
Query
Accepts the external query
that execute along with data processing.
<input type="text" id="country">
import { AutoComplete } from '@syncfusion/ej2-dropdowns';
import { Query, DataManager, ODataV4Adaptor } from '@syncfusion/ej2-data';
let autocomplete: AutoComplete = new AutoComplete({
//set the local data to dataSource property
dataSource: new DataManager({
url: 'https://services.odata.org/V4/Northwind/Northwind.svc/',
adaptor: new ODataV4Adaptor,
crossDomain: true
}),
query: new Query().from('Customers').select(['ContactName', 'CustomerID']).take(6),
// map the appropriate columns to fields property
fields: { value: 'ContactName' },
// set the placeholder to AutoComplete input element
placeholder: 'Find a customer',
});
autocomplete.appendTo('#country');
boolean
When set to true, the user interactions on the component are disabled.
boolean
Specifies whether to show or hide the clear button.
When the clear button is clicked, value
, text
, and index
properties are reset to null.
boolean
Allows you to either show or hide the popup button on the component.
Specifies the sortOrder
to sort the data source. The available type of sort orders are
None
- The data source is not sorting.Ascending
- The data source is sorting with ascending order.Descending
- The data source is sorting with descending order. number
Supports the specified number
of list items on the suggestion popup.
number
| string
| boolean
| object
| null
Gets or sets the value of the selected item in the component.
string
| number
Specifies the width of the component. By default, the component width sets based on the width of its parent container. You can also set the width in pixel values.
number
specifies the z-index value of the component popup element.