0

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?

1 Answer 1

3

I believe that

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

should be

<core:Item text="{cities>name}" />
Sign up to request clarification or add additional context in comments.

2 Comments

Unfortunately I've tried that and it is still not working. If I take a look at the UI5 Diagnostics tool it says that the path is invalid. As far as I know though, everything is correct.
It seems it was the size of my JSON file that was the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.