json - Binding in List with XML -
i want use xml bind list data of json file.
here code:
xml view:
<list headertext="positions" items="{/positions}"> <objectlistitem title="{positions>id}"> </objectlistitem> </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. "no data" time. there nothing in console saying there problem here.
your binding title
attribute not correct. want bind directly id
attribute of positions
, no need specify model:
<list headertext="positions" items="{/positions}"> <objectlistitem title="{id}"> </objectlistitem> </list>
Comments
Post a Comment