I have a master-detail application that consumes an OData service (declared in manifest.json).
In the detail controller, I bind the model to the view in the following way (this method is attached to a router object).
_onObjectMatched: function(oEvent) {
this.getView().bindElement({
path: "/ContractCompSet('" + oEvent.getParameter("arguments").id + "')",
model: "contracts"
});
}
How can I access the actual bound model object from within this controller?
Closest I got (but seems too be a little too complicated) is as follows
var path = this.getView().getElementBinding('contracts').sPath.substring(1);
var model = this.getView().getModel('contracts').oData[path];
this.getView().getBindingContext("NAME_OF_MODEL")
. This gives me the context which is bound to the view. You can then do.getObject()
to access the actual data. Give me a code example and I can try to help. – Marc