Showing results for 
Search instead for 
Did you mean: 

How to find a default value to AutoComplete Control

Former Member
0 Kudos


I am using AutoComplete control where i populate it with data from an oData service

var control= new sap.ui.commons.AutoComplete({

  displaySecondaryValues: true,

  items: {

  path: "/",

  template: new sap.ui.core.ListItem({text:"{NAME}", key:"{HOSPITAL_ID}", additionalText:"{STATE}"})



This is my implementation in fragment and in on after rendering I want to bind a default value to it.How can I achieve this?

for e.g.:

In drop down box I can achieve this with the below code


I tried with similar approaches for AutoComplete control but I cannot bind value to it..Anyone can suggest a possible solutions please?

Best Regards,

Amala Suganya

Accepted Solutions (0)

Answers (1)

Answers (1)

Active Contributor
0 Kudos


if you want to display default value in AutoComplete then you can do it as below,

                var oAuto1 = new sap.ui.commons.AutoComplete("TextField-1", {

                                tooltip: "This is an Auto Complete TextField",

                                change: onChange,

                               value: aData[5].name,

                                maxPopupItems: 2,

                                ariaDescribedBy: "MyDesc",

                                ariaLabelledBy: "MyLbl"


value property is used to display default value. alternatively you can use setValue method.

also refer this example AutoComplete - sap.ui.commons