Skip to Content

Navigation or Routing between pages with in View

Hi Folks,

@Prathik Nagaraj

@Ian MacGregor

here is one scenario,

i have created one SAPUI5 project it consists only one view, view name is "pageNavigation". this view contains three pages within the view.

View Code:

<mvc:View controllerName="PageNavigation.controller.pageNavigation" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc"

xmlns="sap.m">

<App id="myApp" initialPage="idMyPage1">

<pages>

<Page title="My Page1" id="idMyPage1">

<content>

<Button

id="idBtnMyPage1"

text="My Page2"

press="onPressMyPage1">

</Button>

</content>

</Page>

<Page title="My Page2" id="idMyPage2">

<content>

<Button

id="idBtnMyPage2"

text="My Page3"

press="onPressMyPage2">

</Button>

</content>

</Page>

<Page title="My Page3" id="idMyPage3">

<content>

<Button

id="idBtnMyPage3"

text="My Page1"

press="onPressMyPage3">

</Button>

</content>

</Page>

</pages>

</App>

</mvc:View>

Controller Code:

sap.ui.define([

"sap/ui/core/mvc/Controller"

], function(Controller) {

"use strict";

return Controller.extend("PageNavigation.controller.pageNavigation", {

onPressMyPage1: function() {

alert("My Page1");

debugger;

var app = this.getView().byId("myApp");

app.to("idMyPage2");

},

onPressMyPage2: function() {

alert("My Page2");

debugger;

// var app = sap.ui.getCore().byId("myApp");

var app = this.getView().byId("myApp");

app.to("idMyPage3");

},

onPressMyPage3: function() {

alert("My Page3");

debugger;

var app = this.getView().byId("myApp");

app.to("idMyPage1");

},

onInit: function() {

var app = this.getView().byId("myApp");

var page1 = this.getView().byId("idMyPage1");

var page2 = this.getView().byId("idMyPage2");

var page3 = this.getView().byId("idMyPage3");

app.addPage(page1).addPage(page2).addPage(page3);

}

});

});

am not using index.html, this is directly written in controller of the View.

Can you please help me to find the gap. there is no error am getting once i execute this app.

Thank You for your help.

Best Regards,

Kiran.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Aug 22, 2016 at 12:17 PM

    Hi Kiran,

    try to call the page ids with this.createId("yourId") in your controller instead of using "yourId" directly.

    Regards,

    Daniel

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.