You can define input suggestion for Input control with defined search help using SAP Standard Search Help.
Prerequisite:
Input control with defined search help using SAP Standard Search Help.
Expected output after implementation:
Select input control in layout of your project.
In properties window of selected input control, select More to open dialog to present additional properties.
In additional properties dialog, define the following values:
text Format Mode: Key
show Suggestion: true
suggestion Items: {_services>/GenSearchHelp}
suggest: define JS function to handle suggest event i.e: handleSuggestion(evt)
suggestionItemSelected: define JS function to handle event when suggestion item is selected i.e: handleSugItemSel(evt).
Add a script node in your project, open editor and add following implementation for JS function to handle suggest event:
function handleSuggestion(evt){ //Get suggest value from input control var sTerm = evt.getParameter("suggestValue"); //Build filter list for EntitySet GenSearchHelp of built-in OData Model _services var aFilters = []; if (sTerm) { aFilters.push(new sap.ui.model.Filter("Name", sap.ui.model.FilterOperator.Contains, sTerm)); } //Get configuration data from defined Search help for input control var oConfig = evt.getSource().data("config"); if(oConfig){ aFilters.push(new sap.ui.model.Filter("Config", sap.ui.model.FilterOperator.EQ, oConfig)); } //Apply filter for EntitySet GenSearchHelp. evt.getSource().getBinding("suggestionItems").filter(aFilters); }
Save your project and test to see the outcome.