|
let loader: HTMLElement;
// initialize AutoComplete component
let atcObj1: ComboBox = new ComboBox({
// bind the DataManager instance to dataSource property
dataSource: new DataManager({
url: 'https://ej2services.syncfusion.com/production/web-services/api/Employees',
adaptor: new WebApiAdaptor,
crossDomain: true
}),
// bind the Query instance to query property
query: new Query().select(['EmployeeID']).take(10).requiresCount(),
// map the appropriate columns to fields property
fields: { value: 'EmployeeID', text: 'EmployeeID' },
// set the placeholder to AutoComplete input element
placeholder: 'e.g. 1',
// enable the autofill property to fill a first matched value in input when press a down key
autofill: true,
value: 1,
allowFiltering: true,
});
atcObj1.appendTo('#products');
|
|
|
|
// initialize ComboBox component
let comboBoxObj1: ComboBox = new ComboBox({
// bind the DataManager instance to dataSource property
dataSource: new DataManager({
url: 'https://ej2services.syncfusion.com/production/web-services/api/Employees',
adaptor: new WebApiAdaptor,
crossDomain: true
}),
// bind the Query instance to query property
query: new Query().select(['FirstName', 'EmployeeID']).take(10).requiresCount(),
// map the appropriate columns to fields property
fields: { text: 'FirstName', value: 'EmployeeID' },
// set the placeholder to ComboBox input element
placeholder: 'Select a name',
// set the height of the popup element
popupHeight: '200px',
// sort the resulted items
sortOrder: 'Ascending',
created: function(args){
comboBoxObj1.element.value = "Janet Leverling"; // To set the value to the component
},
dataBound: function(args){
comboBoxObj1.value = 3; // to make the provided value selected state on popup opening
}
});
comboBoxObj1.appendTo('#customers'); |
Hi shamsmehra,
Greetings from Syncfusion support.
Could you please raise the query. We are hear to help you with pleasure.
Regards,Ponmani M