Skip to Content
avatar image
Former Member

how to set view Id ???

Hello everyone,

I am working on a project in which I am using component.js and routing for navigating between views my project consist of no of views which I have defined in one view App.view.js below is the code of app.view.js

createContent: function (oController) {

  // to avoid scroll bars on desktop the root view must be set to block display
  this.setDisplayBlock(true);

  // create app
  this.app = new sap.m.App("App");
// this.app.setBackgroundImage("images/bg2.jpg");

  var launchpad = sap.ui.xmlview("launchpad", "sap.ui.KOL.view.launchpad");
  launchpad.getController().nav = this.getController();
  this.app.addPage(launchpad);
//
  var allKOL = sap.ui.xmlview("allKOL", "sap.ui.KOL.view.allKOL");
  allKOL.getController().nav = this.getController();
  this.app.addPage(allKOL);

as you can see I have given ids to the view launchpad and all kol but when I am running the application the ids are getting initialized automatically as __xmlview00 and is not taking as what I have assigned in the app.view.js .

So can anyone please help me with assigning the ids to the view.

Thanks in advance

Anshul Dharmadhikari

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jan 12, 2015 at 10:08 AM

    As far as I know, you can't set ID to xml view.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      I think you set the view id's correctly but you might have missed

      return this.app;

      If already above syntax exist , use below and play .

      this.app.addPage(launchpad,false); 

      this.app.addPage(allKOL,true);

      I am able to use similar to your approach already. If still it won't work , you should check app.controller code which may be creating trouble .

      Regards,

      Koti Reddy

  • Jan 20, 2015 at 09:02 AM

    Hi,

      That is the standard behavior of creating unique Ids. It is clearly stated even in the sdk help that when ever you set and ID it is either prefixed with view Id

    SAPUI5 SDK - Demo Kit

    SAPUI5 SDK - Demo Kit

    may be you can try using createId() method.

    Regards

    Pavan

    Add comment
    10|10000 characters needed characters exceeded