我有两个包含动态列表的母版页。
Master Page 1:
<Page title="Title" showBackButton="true" id="master1">
<List id="idListAuctions" mode="SingleSelectMaster" select="onPressGoToMaster2" items="{auctions>/AuctionsGlobal/0/AuctionsTypes}">
<items>
<StandardListItem title="{auctions>AuctionType}" type="Navigation" />
</items>
</List>
</Page>
Master Page 2:
<List id="idListAuctionsDetail" mode="SingleSelectMaster" select="handleListSelect"
items="{AuctionTypes/Auctions}">
<items>
<StandardListItem>
<!-- Output the items from Master Page 1 -->
</StandardListItem>
</items>
</List>
我的Javascript:
onPressGoToMaster2 : function(oEvent) {
console.log( oEvent.getParameter("listItem").getBindingContext() ); //undefined
this.byId("hdcSplitApp").toMaster(this.createId("master2"),'slide', oEvent.getParameter("listItem").getBindingContext());
},
我的JSON文件:
{
"AuctionsGlobal": [{
"AuctionsTypes": [{
"AuctionType": "Delivery",
"Auctions": [{
"AuctionID": "12345"
}, {
"AuctionID": "54321"
}]
}, {
"AuctionType": "Contract",
"Auctions": [{
"AuctionID": "98745"
}, {
"AuctionID": "56478"
}]
}]
}]
}
我想显示所选的&#34;拍卖&#34;来自我master1
页面上的master2
。 master2
似乎没有数据。我已经尝试了很多,但我没有得到它。
答案 0 :(得分:1)
由于您使用命名模型作为绑定列表,因此应将模型名称作为参数传递给getBindingContext
。
此外,使用setBindingContext
从第二个母版页设置列表的绑定上下文和getBindingContext
获得的上下文。
Here正在运作。