Olis
Olis

Reputation: 47

SAPUI5 named model binding for Searchable Input

I am currently writing a simple application which contains a pop-up dialog for a registration in SAPUI5 with an XML view for the fragment. I have two JSON files, one for country and one for cities and am trying to bind JSON to a drop down for countries and to a searchable input for cities. The countries binding works but the cities does not. I am making use of named binding and am unsure where I am going wrong.

var countryModel= new JSONModel(jQuery.sap.getModulePath("com.bankdetails.BankDetails", "/model/countries.json")); 
countryModel.setSizeLimit(500);
this._oDialog.setModel(countryModel); 

var cityModel= new JSONModel(jQuery.sap.getModulePath("com.bankdetails.BankDetails", "/model/cities.json")); 
cityModel.setSizeLimit(10000000);
this._oDialog.setModel(cityModel, "cities"); 

this.getView().addDependent(this._oDialog);

Then in my XML view I have the following:

       <ComboBox 
            items="{
                path: '/countries',
                sorter: { path: 'name' }
            }">
            <core:Item key="{name}" text="{name}" />
        </ComboBox>
        <Label text="City"></Label>
        <Input
            id="cityInput"
            type="Text"
            placeholder="Enter City ..."
            showSuggestion="true"
            suggestionItems="{cities>/cities}" >
            <suggestionItems>
                <core:Item text="{cities>/name}" />
            </suggestionItems>
        </Input>

The combo box (which doesn't make use of named binding) works but the cities searchable input does not. Any ideas what I am doing wrong?

Upvotes: 0

Views: 652

Answers (1)

D. Seah
D. Seah

Reputation: 4592

I believe that

<core:Item text="{cities>/name}" />

should be

<core:Item text="{cities>name}" />

Upvotes: 3

Related Questions