Skip to Content
0

Fiori extend with suggest for external url

Mar 27, 2017 at 06:48 AM

96

avatar image
Former Member

Not able to do suggest item for standard Fiori Apps.

Input suggestion item does not work while extending a standard FIORI Apps for a custom input field. It is taking default OData model of the FIORI. Same code works if we run in separate UI5 Application.

I have created below input field in fragment:-

<Input id="idAddress" type="Text" showSuggestion="true" suggest="onAddressTyped" suggestionItems="{myModel>/results}" suggestionItemSelected="onAddressSelected"> <suggestionItems> <core:Item text="{formatted_address}" /> </suggestionItems> </Input>

Controller:- Code is triggering in success method but suggestion is not working

onAddressTyped : function(oEvent) { // var sTerm = oEvent.getParameter("suggestValue"); if (sTerm.length >= 8) { var aFilters = []; if (sTerm) {

url = 'XXXX'

oModel1 = new sap.ui.model.json.JSONModel();

$ .ajax({ url : url,

jsonpCallback : 'getJSON', contentType : "application/json", dataType : 'json',

success : function(data, textStatus, jqXHR) {

sap.ui.getCore().setModel(oModel1, "myModel");

aFilters.push(new sap.ui.model.Filter("formatted_address", sap.ui.model.FilterOperator.Contains, "")); oEvent.getSource().getBinding("suggestionItems").filter(aFilters);

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers