Skip to Content

Navigate between two or multiple views in sap.ui.commons

Hi,

I have created multiple views in my sap.ui.commons application.

and looking for solution, where I can switch from one view to another view.

just the same way, we do in sap.m.app with .TO / .BACK functionality.

Please guide me how to achieve it.

Note: Application is created with Java Script option.

Regards,

Praveer.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Mar 26, 2015 at 08:37 AM

    Hi Praveen,

    This thread might help you:

    1. I use a container, e.g. a ux3 shell, and I add the desired view to it, and change it when I want to see another view.

    index.html

     
    1. var oShell = new sap.ui.ux3.Shell({
    2. id: "shell",
    3. });
    4. var loginView = sap.ui.view({
    5. id: "loginView",
    6. viewName : "viewt.Login",
    7. type: sap.ui.core.mvc.ViewType.JS
    8. });
    9. var listView = sap.ui.view({
    10. id: "listView",
    11. viewName : "view.List",
    12. type: sap.ui.core.mvc.ViewType.JS
    13. });
    14. oShell.addContent(sap.ui.getCore().byId("loginView"));

    e.g. when login is successfull: view.Login.js

    1. oShell.setContent(sap.ui.getCore().byId("listView"));  

    Regards,

    RW

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 26, 2015 at 09:04 AM

    hi Praveer,

    in sap.ui.commons also u can do navigation lik sap.m.app.

    but for sap.ui.commons here is the code.

    1st view to 2nd view,

    var oShell= sap.ui.getCore().byId("idShell");

    oShell.removeAllContent();

    var secondview = sap.ui.view({id :"idinvdtl1", viewName :"com.arteriatech.ppd.invoicelst.InvDtl.invdtl", type:sap.ui.core.mvc.ViewType.JS});

    oShell.addContent(secondview);

    back to 1st view,

    var oShell= sap.ui.getCore().byId("idShell");

    var firstview= sap.ui.getCore().byId("firstViewId");

    oShell.removeAllContent(firstview);

    firstview.destroy();

    oShell.addContent(firstview);

    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.