I am looking to connect a list along with its content to a model.
var listItem = new sap.m.StandardListItem({
title: "{carDataModel>/cars/1/carId}",
});
var list = new sap.m.List("carList", {
});
list.bindItems('carDataModel>/cars', listItem);
I have linked the following model to the view:
{
"cars":[
{
"carId":"e7f2b1519ed5",
"carName":"one",
},
{
"carId":"f3ab598a85e0",
"carName":"two",
}
]
}
Currently, my list displays two List Items and I can toggle between values by changing the index from 1 to 0. However, I want the first List Item to show the first carId and the second List Item to display the second carId. Despite trying different syntaxes, I have not been successful as it resulted in an empty List Item.
Appreciate your help!