on 01-12-2015 8:33 AM
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
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
may be you can try using createId() method.
Regards
Pavan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As far as I know, you can't set ID to xml view.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Generally we set views if from component.js like as shown below.
jQuery.sap.declare("xxx.Component");
sap.ui.core.UIComponent.extend("xxx.Component", {
createContent : function() {
// create root view
var oView = sap.ui.view({
id : "ViewAppId",
viewName : "xxx.view.viewName",
type : "XML",
viewData : { component : this }
});
id: sets the id for the XML View.
Regards,
Koti Reddy
Hi Koti Reddy,
This I have written for the parent app App.view.js but the problem is coming with the child apps of this App.view.js as you can see I have shared the code for App.view.js I have given the id for launchpad as launchpad but its not taking this id instead application is giving the default id __xmlview0
it would be great if you can help me with this issue.
Thanks
Anshul dharmadhikari
Hi Anshul,
I still think there is no way to give a XML View an ID.
Why don't you create your App like the Best Practices from the Developer Guide.
There you don't need an XML View ID for navigation.
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
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.