2016-05-28 4 views
0

ダイナミックリストを持つ2つのマスターページがあります。sapui5 - 2つのマスターページ

マスターページ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> 

マスターページ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" 
      }] 
     }] 
    }] 
} 

選択した「オークション」の項目をmaster1からmaster2ページに表示したいとします。 master2にはデータがないようです。私はそれほど試しましたが、私はそれを得ていません。

答えて

1

バインディングリストに名前付きモデルを使用しているため、モデル名は引数としてgetBindingContextに渡す必要があります。

setBindingContextさらに、getBindingContextで取得されたコンテキストを使用して、2番目のマスターページからのリストのバインディングコンテキストを設定します。

Hereは動作例です。

+0

ありがとうございますが、このパスを使用する方法はわかりません:-( 'this.byId(" hdcSplitApp ")。toMaster(this.createId(" master2 ")、 'slide'、context); ' ' master2'のパスはどうやって使うことができますか?申し訳ありませんが、私はsapui5の初心者です – alexP

+0

修正された答えを確認してください。 – Dopedev

+0

ああ、ありがとう。 – alexP

関連する問題