Skip to Content
0
Former Member
Jun 28, 2016 at 11:59 AM

Cann't bind list with json model via XML

676 Views

Hey guys,

I want to use only XML to bind some data in a .json file withe a list.

Here is my code:

XML View:

<List headerText="Positions" items="{/Positions}">
<ObjectListItem title="{positions>id}"/>
</List>

index.html

var oPositionsModel = new sap.ui.model.json.JSONModel();
oPositionsModel.loadData("model/Positions.json");
sap.ui.getCore().setModel(oPositionsModel);

model/Positions.json

{ "Positions": [ 
{ "id": 123456, "article": "Abcde", "amount": 12 },
{ "id": 654321, "article": "Edcba", "amount": 21 }
] }

I can't see, what's wrong. But I get "no data" all the time. There is nothing in the console saying there is a problem here.

I hope you can help 😊