我正在研究Sap.m.输入建议项。输入的建议工作正常,但是当我从建议列表中选择一个项目,然后删除该值并输入新值时,它将自动删除新输入的值,而不会显示任何建议。我调试了代码,并在oBinding.filters()行中删除了该值。我的代码如下,
<Input id="input" placeholder="{i18n>input}" editable="true" startSuggestion="2"
showSuggestion="true" suggest="handleSuggest"
suggestionItemSelected="onSelectedItem"
suggestionItems="{path:'abc>/abSet',templateShareable:true, parameters:{select: 'ab,bc'}}">
<suggestionItems growing="true" growingScrollToLoad="true">
<core:Item key="{abc>ab}" text="{abc>ab} {abc>bc}"/>
</suggestionItems>
</Input>
控制器
handleSuggest: function (oEvent) {
var sTerm = oEvent.getParameter("suggestValue"),
oSource = oEvent.getSource(),
oBinding,
aFilters = [];
oSource.setBusy(false);
if (sTerm) {
aFilters.push(new Filter("bc", FilterOperator.Contains, sTerm));
aFilters.push(new Filter("cd", FilterOperator.EQ, ""));
aFilters.push(new Filter("de",FilterOperator.EQ, ""));
}
oBinding = oSource.getBinding("suggestionItems");
var Filters = [];
Filters.push(new Filter({
filters: aFilters,
and: true
}));
oBinding.getModel().setSizeLimit(500);
oBinding.filter(Filters);
},
//Once the suggestion BP is choosen retreiving the key
onSelectedItem: function (oEvent) {
var sItems = oEvent.getParameter("selectedItem");
if (sItems !== null)
filterValue = sItems.getKey();
},
非常感谢您的帮助
对我来说,解决方案是从key
聚合中的<core:Item />
元素中删除属性suggestionItems
。在版本1.44之后,发生了一些更改,并且属性key
引起了一些奇怪的行为,但我仍然无法弄清原因。