[英]sapui5 complex data binding
I have the following JSON-Model: 我有以下JSON模型:
{
"Auctions": [{
"AuctionsTypes": [{
"AuctionType": "Contract",
"Auctions": [{
"AuctionID": "12345"
}, {
"AuctionID": "54321"
}]
},{
"AuctionType": "Delivery",
"Auctions": [{
"AuctionID": "12345"
}, {
"AuctionID": "54321"
}]
}]
}]
}
My JS: 我的JS:
var oAuctionsModel = new sap.ui.model.json.JSONModel();
oAuctionsModel.loadData("model/mock_auction_types.json");
oView.setModel(oAuctionsModel, "auctions");
I would like to output the AuctionsType
in a list but this code doesn't work. 我想在列表中输出
AuctionsType
,但是此代码不起作用。 The list is empty. 列表为空。
<List id="idListAuctions" items="{auctions>/Auctions/AuctionsTypes}">
<items>
<StandardListItem title="{auctions>AuctionType}" type="Navigation" press="doSomething" />
</items>
</List>
In your data, Auctions
is an array itself, so you have to specify which array element inside you would like to access. 在您的数据中,
Auctions
本身就是一个数组,因此您必须指定要访问的数组元素。
In your example, the first one: 在您的示例中,第一个:
<List items="{auctions>/Auctions/0/AuctionsTypes}">
<StandardListItem title="{auctions>AuctionType}" />
</List>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.