I have the following code in my masterPage:
onInit: function () {
var me = this;
jQuery.ajax({
type: "GET",
contentType: "application/json; charset=utf-8",
url: "RESTAPI",
dataType: "json",
success: function (response, status, xhr) {
debugger;
var oView = me.getView();
var oModel = new sap.ui.model.json.JSONModel();
oModel.setData(response);
oView.setModel(oModel);
}
});
me.mBindingOptions = {};
me.oRouter = sap.ui.core.UIComponent.getRouterFor(this);
me.oRouter.getTarget("listainvestimento").attachDisplay(
jQuery.proxy(me.handleRouteMatched, me));
},
_onListItemPress: function (oEvent) {
var context = oEvent.getParameter("listItem").getBindingContext().getPath().substr(1).split("/")[1]
//context="0" (position in my array model)
var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
oRouter.navTo("detalheinvestimento", {
ctx: context
}, false);
}
And in my DetailPage:
onInit: function () {
this.oRouter = sap.ui.core.UIComponent.getRouterFor(this);
this.oRouter.getTarget("detalheinvestimento").attachDisplay(jQuery.proxy(this.handleRouteMatched, this));
},
handleRouteMatched: function (oEvent) {
this.getView().bindElement({
path: "/" + oEvent.getParameter("arguments").ctx
});
}
Manifest.json
{
"pattern": "listainvestimento/detalheinvestimento/{ctx}",
"name": "detalheinvestimento",
"target": [ "listainvestimento", "detalheinvestimento" ]
},
For more information, I've created prototype screens in Build.me and I'm linking to my actual server data now.
Binding in master occurs successfully, but in non-detail.
I do not know where the error is, the model is being set in the master but when it arrives in the detail it does not link.
The fields names for the binding are correct!
Can anybody help me?