on 2018 Oct 24 12:46 PM
I have a simple model that I want to bind to a sap.m.ComboBox. The data look like this:
(2) ["Tabelle1", "Tabelle2"]
0: "Tabelle1"
1: "Tabelle2"
What I do is this:
... some unimportant stuff before...
var sheets = new sap.ui.model.json.JSONModel(sheetNames);
var comboBox = that.getView().byId("selectSheet");
comboBox.setModel(sheets);
var oItemTemplate = new sap.ui.core.Item();
comboBox.bindItems("/sheets", oItemTemplate)
the comboBox gets created in my XML view:
<m:ComboBoxid="selectSheet"items="{path: '/sheets'}"change="onSheetSelected"><core:Item/></m:ComboBox>
After setting the Model or binding the Items nothing happens.. I feel like that's some simple coding that I'm doing wrong here. Please advise me how to do this. The ComboBox should end up with two simple choices "Tabelle1" and "Tabelle2".
Your template is incorrect. You need to pass the properties as well and with binding and you dont need to set the binditems in javascript code manually as you are setting it already in XML view.
<core:Item key="{key}" text="{text}" /><br>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
66 | |
11 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.