Skip to Content
author's profile photo
Former Member

Fiori getContext Detail page SAPUI5

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();"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({
     navButtonPress: [oController.handleNavButtonPress,oController],

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();


Any suggestions would be highly appreciated.


Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • author's profile photo
    Former Member
    Posted on Mar 24, 2014 at 08:04 AM

    How are you implementing navigation ? Are you using Routing ? Could you post the code of navigation part ? ie the code of function ?

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hello Sakthivel,

      Many thanks for your response. Unfortunately it still doesnt work. I have a small doubt and would like to clarify.

      In the Detail View, do the binding as


      I think this has to be done in the "to" fúnction inside the detail.controller.js isnt it? Because, I tried to do the above and ended up with an error as Uncaught TypeError: Cannot set property 'entityType' of undefined.

      Now, I am trying this in the controller but still do not work. Do you need any more information where you could actually find out what would have been the mistake. If so, I would be glad to provide you with,

      Kindly help. Thanks


  • author's profile photo
    Former Member
    Posted on Mar 24, 2014 at 09:22 AM

    Can you try attachChange on your List this should notify you when any property of List has changed its bindingContext and then get the changed bindingContext.

    Add comment
    10|10000 characters needed characters exceeded