Hello all
I am currently workign on Fiori like App using SAPUI5. I have successfully built the Master page, and on item click I set the context and navigate to Detail page.
The context path from Master page is something like "/SUPPLIER("NAME")". The function in App.controller.js is as follows:
handleListItemPress : function (evt) { var context = evt.getSource().getBindingContext(); this.nav.to("Detail", context);}
But I would like to know how can I access this context in the deatil page. I need this because I need to use $expand to build the url and bind the items to a table.
Here is my Detail.view.js
sap.ui.jsview("sap.ui.demo.myFiori.view.Detail", { getControllerName: function () { return "sap.ui.demo.myFiori.view.Detail"; },
createContent: function (oController) { var page2 = new sap.m.Page({ title:"Supplier", class:"sapUiFioriObjectPage", showNavButton:true, navButtonPress: [oController.handleNavButtonPress,oController], content:[list]});
var list = new sap.m.List("list2"); var itemTemplate = new sap.m.ObjectListItem({ title : "{NAME}", type: sap.m.ListType.Active, number : "{LIFNR}", numberUnit : "ID", attributes : new sap.m.ObjectAttribute("attr2",{text:"{CITY}"}), press: [oController.handleListItemPress, oController],}); var test = this.getBindingContext();
list.bindItems(test.getPath()+"/MASTERDATA",itemTemplate);
Any suggestions would be highly appreciated.
Thanks