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> 

working demo in jsbin


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -