我正在使用SAPUI5,我有一個MasterPage和一個DetailPage,在MasterPage中我有一個List,當我在List中選擇de Item時,信息顯示在DetailPage中。如何獲取視圖的數據
在DetailPage中,我有一個PositiveAction,當我按下PositiveAction時,我需要獲取DetailPage的數據,但我不知道如何做到這一點。
我的項目的代碼按
onPoSelect : function(oEvent) {
var oListItem = oEvent.getParameter('listItem');
var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
oRouter.navTo("DetailPanel", {
invoicePath: oListItem.getBindingContext("solped").getPath().substr(1)
});
},
我在DetailPanel
onInit: function(){
var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
oRouter.getRoute("DetailPanel").attachPatternMatched(this._onObjectMatched, this);
},
_onObjectMatched: function (oEvent) {
this.getView().bindElement({
path: "/" + oEvent.getParameter("arguments").invoicePath,
model: "solped"
});
},
線 「oEvent.getParameter(」 參數 「)的代碼。invoicePath,」
返回此。
發票(CustomerName ='Alfreds Futterkiste',Discount = 0f,OrderID = 10702,ProductID = 3,ProductName ='Aniseed Syrup',Quantity = 6,Salesperson ='Margaret Peacock',ShipperName ='Speedy Express', UnitPrice = 10.0000M)
我有信息,但它是一個字符串,我怎樣才能在一個對象中轉換這個字符串?或者,我還可以如何訪問視圖中的信息?
視圖
謝謝阿米戈,它的工作原理,謝謝您的回答。 –