Javascript 如何像sap.m.Input一样在sap ui5的文本字段中设置自动完成或自动建议?
它将错误显示为未找到suggestionItems。Javascript 如何像sap.m.Input一样在sap ui5的文本字段中设置自动完成或自动建议?,javascript,jquery,sapui5,Javascript,Jquery,Sapui5,它将错误显示为未找到suggestionItems。var oFiled=new sap.ui.commons.AutoComplete({ this code is written in my controller. var textField = new sap.ui.commons.TextField({ editable: true, liveChange:this._suggest.bind(this) }).bindProperty("value", name
var oFiled=new sap.ui.commons.AutoComplete({
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}"
}));
}
是的,
建议:此。_autoSuggest.bind(此)
}).bindValue(“名称”);
_自动建议:函数(){
对于(变量i=0;i
为什么不呢?因为我想使用ui.commons.textfield,因为m的大小大于需求…所以请提出一些建议…不幸的是,我无法执行您的代码..如果可能,请提供一个JSBin..是否包含livechange
处理程序?我让showSuggestion=“true”和suggestionItems聚合绑定模型。成功了。
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
}));
}
}
}