cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a navigation with different views and controllers?

Former Member
0 Kudos

i want to know any method to refresh pages for mobile or instead of using app.to we can load a view seperately.... right now what happens my page is loading too slow because i am calling these views like this:

Application.js :

main : function() {       

        sap.ui.localResources("app.view");

        var root = this.getRoot();

       

        App = new sap.m.App("MOBILE",{initialPage:"login"}); 

        var loginPage = sap.ui.view({id:"login", viewName:"app.view.login", type:sap.ui.core.mvc.ViewType.JS}); 

        var setContext = sap.ui.view({id:"setContext", viewName:"app.view.setContext", type:sap.ui.core.mvc.ViewType.JS});

        var screens = sap.ui.view({id:"screenSelection", viewName:"app.view.screenSelection", type:sap.ui.core.mvc.ViewType.JS});

        var standardTransactions = sap.ui.view({id:"transactions", viewName:"app.view.standardTransactions", type:sap.ui.core.mvc.ViewType.JS});

   

        App.addPage(loginPage).addPage(setContext).addPage(screens).addPage(standardTransactions);

        App.placeAt(root); 

}

index.html:

<html>

<head>

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <link rel="stylesheet" href="app/css/MobileStyles.css">

    <title>Mobile</title>

    <!-- src Location of SAP UI5 libraries need to be changed to refer to right location -->

    <script

        src="/sap/ui5/1/resources/sap-ui-core.js"

        id="sap-ui-bootstrap"

        type="text/javascript"

        data-sap-ui-theme="sap_bluecrystal"

        data-sap-ui-xx-bindingSyntax="complex"

        data-sap-ui-libs="sap.m">

    </script>

    <script>

        jQuery.sap.registerModulePath('Application', 'Application');

       

        // launch application

        jQuery.sap.require("Application");

   

        new Application({

            root : "content"

        });

       

    </script>

</head>

<body class="sapUiBody" role="application">

    <div id="content"></div>

</body>

</html>

If i have to load any view i have to use app.to() and this method only navigate to the page already loaded first time. If i want to refresh or reload any view what i should do and how to reduce my long loading time.Please tell me any alternative to this ASAP.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I got it how to navigate between pages and load them at any event. The best way is to define sap.m.App it act as a container to load sap.m.Page so u can create as many pages u want and add to the sap.m.App using addPage('<pagename>'). and using app.to() you can navigate to the pages with its IDs. You have to place this sap.m.App at the index.html using placeAt(). and load other views as required. One important thing make the app variable as global to access in all pages.

Answers (1)

Answers (1)

santhu_gowdaz
Active Contributor
0 Kudos

Hi sarvan,

               2nd view init method code??

after navigate to 2nd view u need to bind the 2nd view items.

this may help u