Skip to Content
avatar image
Former Member

getting error as app.addPage while creating fiori like apps

Hi,

While creating fiori like apps .I am getting following error at this.app.addPage(master, true);   as

Error Msg: Uncaught TypeError: Cannot read property 'addPage' of undefined

UI5.view.js

---------------------------------

sap.ui.jsview("sap.ui.demo.myFiori.ui5component.UI5", {

  getControllerName : function() {

  return "sap.ui.demo.myFiori.ui5component.UI5";

  },

createContent : function(oController) {

  var app = new sap.m.App();

  this.setDisplayBlock(true);

  var master = sap.ui.view({id:"Master",

  viewName:"sap.ui.demo.myFiori.ui5component.master", type:sap.ui.core.mvc.ViewType.JS});

  master.getController().nav = this.getController();

  this.app.addPage(master, true);

  var detail = sap.ui.view({id:"Detail",

  viewName:"sap.ui.demo.myFiori.ui5component.detail", type:sap.ui.core.mvc.ViewType.JS});

  //app.addMasterPage(master).addDetailPage(detail);

  detail.getController().nav = this.getController();

  this.app.addPage(detail);

  //this.app.addPage(master);

  return app;

  }

});

master.view.js

--------------------------

sap.ui.jsview("sap.ui.demo.myFiori.ui5component.master", {

  getControllerName : function() {

  return "sap.ui.demo.myFiori.ui5component.master";

  },

  createContent : function(oController) {

  var list1 = new sap.m.List({

  id : "master", inset: false,

  press : function(oevent)

  {oController. handleListItemPress();}

  });

  var template = new sap.m.StandardListItem({

  title : "{SoId}"

  });

  list1.bindItems({path : "/SalesOrderCollection",template :template} );

  return list1;

master.controller.js

------------------------

sap.ui.controller("sap.ui.demo.myFiori.ui5component.master", {

  handleListItemPress : function (evt) {

  var context = evt.getSource().getBindingContext();

  this.nav.to("Detail1", context);

  }

});

  }

});

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Jan 04, 2015 at 06:22 PM

    Hi, But if am using app.addPage() instead of this.app.addPage() it is working fine.I am not getting why,Please some one help me out

    Add comment
    10|10000 characters needed characters exceeded