Skip to Content
0
Feb 17, 2017 at 03:33 PM

How to load suggestion model only when onSuggest triggered

1538 Views Last edit Feb 17, 2017 at 03:37 PM 2 rev

Hi,

we have a lot of input fields with suggestion functionality on one page.

The suggestion models (aggregations) are loaded on start (initial loading).

How is it possible to load the suggestions on typing or on focus?

I tried following:

<Input
				id="productInput"
				type="Text"
                                value="anotherModel"
				placeholder="Enter Product ..."
				showSuggestion="true"
				suggest="handleSuggest">
			</Input>

and:

handleSuggest: function(oEvent) {
			var sTerm = oEvent.getParameter("suggestValue");
			var aFilters = [];
			if (sTerm) {
				aFilters.push(new Filter("Name", sap.ui.model.FilterOperator.StartsWith, sTerm));
                                var ObjectListItem....
                                oEvent.getSource().bindAggregation("suggestionItems", "myModel", oItemTemplate)
			}
			oEvent.getSource().getBinding("suggestionItems").filter(aFilters);
		}

If this is possible, the binding should only processed once.

Or binding should processed onFocus...

Thanks,

Martin