alexP alexP - 1 year ago 156
Javascript Question

sapui5 - Two master pages

I've got two master pages with dynamic lists.

Master Page 1:

<Page title="Title" showBackButton="true" id="master1">
<List id="idListAuctions" mode="SingleSelectMaster" select="onPressGoToMaster2" items="{auctions>/AuctionsGlobal/0/AuctionsTypes}">
<StandardListItem title="{auctions>AuctionType}" type="Navigation" />

Master Page 2:

<List id="idListAuctionsDetail" mode="SingleSelectMaster" select="handleListSelect"
<!-- Output the items from Master Page 1 -->

My Javascript:

onPressGoToMaster2 : function(oEvent) {
console.log( oEvent.getParameter("listItem").getBindingContext() ); //undefined
this.byId("hdcSplitApp").toMaster(this.createId("master2"),'slide', oEvent.getParameter("listItem").getBindingContext());

My JSON File:

"AuctionsGlobal": [{
"AuctionsTypes": [{
"AuctionType": "Delivery",
"Auctions": [{
"AuctionID": "12345"
}, {
"AuctionID": "54321"
}, {
"AuctionType": "Contract",
"Auctions": [{
"AuctionID": "98745"
}, {
"AuctionID": "56478"

I want to display the items from the selected "Auction" from
on my
page. There seems to be no data on
. I've tried so much but i don't get it.

Answer Source

Since you are using named model for binding list, model name should be passed to the getBindingContext as argument.

Further, use setBindingContext to set binding context of list from second master page with context obtained by getBindingContext.

Here is working example.