简体   繁体   中英

How to set auto complete or auto suggestion in text field in sap ui5 like sap.m.Input?

this code is written in my controller.
var textField = new sap.ui.commons.TextField({
    editable: true,
    liveChange:this._suggest.bind(this)
    }).bindProperty("value", name);
    _suggest:function(oevent){//this method is called for auto sugggest
    oEvent.getSource().bindAggregation("suggestionItems", path,
    new sap.ui.core.Item({
            text: "{name}"
    }));
}

it show a error as suggestionItems not found .

var oFiled = new sap.ui.commons.AutoComplete({
    editable: true,
    suggest: this._autoSuggest.bind(this)
}).bindValue("name");

_autoSuggest: function() {
    for (var i = 0; i < aData.length; i++) {
        if (jQuery.sap.startsWithIgnoreCase(aData[i].name, sValue)) {
            oEvent.getSource().addItem(new sap.ui.core.ListItem({
                text: aData[i].name
            }));
        }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM