Example of Data Binding in Blazor AutoComplete Component
This example demonstrates the AutoComplete's data binding support. Type a character(s) in the AutoComplete component and the remaining characters will be automatically filled based on the first matched item from the suggestion list. When you type the remote data AutoComplete, the loader icon will appear until the remote request retrieves the data from the server and displays it.
The AutoComplete filter the data either from local data sources or remote data services through the DataSource property.
It supports the data type of Array
, Observable Collection
, ExpandoObject
, DynamicObject
and DataManager
.
The DataManager, that acts as an interface between the service endpoint and AutoComplete will require the following minimal information to interact with the service endpoint properly.
- DataManager.Url - Defines the service endpoint to fetch data.
DataManager.Adaptor - Defines the adaptor option. By default,
ODataAdaptor
is used for remote binding. The adaptor is responsible for processing responses and requests from/to the service endpoint. Syncfusion.Blazor.Data package provides some predefined adaptors that are designed to interact with particular service endpoints. They are:UrlAdaptor
- Use this to interact with any remote services.ODataAdaptor
- Use this to interact with OData endpoints.ODataV4Adaptor
- Use this to interact with OData V4 endpoints.WebApiAdaptor
- Use this to interact with Web API created under OData standards.WebMethodAdaptor
- Use this to interact with web methods.
Below are the different types of data binding used in this sample.
- Local Data AutoComplete is bound to a collection of countries data.
- Remote Data AutoComplete is bound to a collection of customer data using
DataManager
. - Observable Collection AutoComplete is bound to a
ObservableCollection
of colors data. - ExpandObject AutoComplete is bound to the collection of vehicles data of type
ExpandObject
. - DynamicObject AutoComplete is bound to the collection of customers data of type
DynamicObject
.
See also