steinroe steinroe - 1 year ago 535
JSON Question

SAPUI5 List Data Binding Array

I want to bind a list and its content to a model.

var oT = new sap.m.StandardListItem({
title: "{carDataModel>/cars/1/carId}",

var oList = new sap.m.List("carList", {
oList.bindItems('carDataModel>/cars', oT);

I attached the following model to the view:


This way I get a list consisting of two List Items and by changing the 1 to a 0 I can switch between the values. But I want the first carId to apppear in the first Item and the second in the second. I tried several syntaxes but they all resulted into an empty List Item.

Thank You!

Answer Source

You are referencing an absolute path to the title in your template. Change it to a relative path (i.e., relative to the current item in your list) instead:

var oT =  new sap.m.StandardListItem({
    title: "{carDataModel>carId}",
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download