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

AbotX : How do you create a parallel crawler that stays on and can be added to at run time from new requests -

testing - Detect whether test has failed within fixture -

android - Create single AAR file from multiple modules using Gradle -