版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_41012753/article/details/79091989
In manifest.json of routers we add parameter’s Path.
Overview.view.xml
Detail.view.xml
Overview.controller.js
We need o get the click path
onPress: function(oEvent) {
var oItem = oEvent.getSource();
var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
oRouter.navTo("detail", {
invoicePath: oItem.getBindingContext("invoice").getPath().substr(1)
//substr meaning that getPath’s first node
});
}
Detail.controller.js
onInit: function () {
var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
//I think this step could to get the parameter’s Path
oRouter.getRoute("detail").attachPatternMatched(this._onObjectMatched, this);
//according for onObjectMatched to binding model
},
_onObjectMatched: function (oEvent) {
this.getView().bindElement({
path: "/" + oEvent.getParameter("arguments").invoicePath,
model: "invoice"
});
}