Quantcast
Channel: SCN: Message List - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 8124

Re: Navigation between the views

$
0
0

Hi Ameya,

 

Thanks for the update.

 

I have some doubts in the above link that you had mentioned in that you have declare the second view also

 

<script>
    sap.ui.localResources("ui5nav");
    var view1 = sap.ui.view({id:"idV11", viewName:"ui5nav.V1", type:sap.ui.core.mvc.ViewType.JS});
    var view2 = sap.ui.view({id:"idV21", viewName:"ui5nav.V2", type:sap.ui.core.mvc.ViewType.JS});
    var oShell = new sap.ui.ux3.Shell({ 
                    id: "shell", 
                    });
    oShell.addContent(sap.ui.getCore().byId("idV11"));
    oShell.placeAt("content"); 
    //view.placeAt("content");
  </script>

 

In my index.html i had declare the following code

 

</script>
  <!-- only load the mobile lib "sap.m" and the "sap_bluecrystal" theme -->
 
 

  <script>
    sap.ui.localResources("navigation");
    var app = new sap.m.App({initialPage:"idDataNavigation1"});
    var page = sap.ui.view({id:"idDataNavigation1", viewName:"navigation.DataNavigation", type:sap.ui.core.mvc.ViewType.JS});
    app.addPage(page);
    app.placeAt("content");

 

   
  </script>
 
  <script>
    sap.ui.localResources("navigation");
    var app = new sap.m.App({initialPage:"idDisplayData1"});
    var page = sap.ui.view({id:"idDisplayData1", viewName:"navigation.DisplayData", type:sap.ui.core.mvc.ViewType.JS});
    app.addPage(page);
    app.placeAt("content");
  </script>
 
 
 
  <script>
    var oShell=newsap.ui.ux3.Shell({id:"shell",});   //Defining a shell
    oShell.addContent(sap.ui.getCore().byId("idDataNavigation1"));//Adding view to the Shell by using viewid
    oShell.placeAt("content");
      
  </script>

 

In the view for forward button I had written the following code:

 

oMatrix.createRow(
  
  // following function defines a button to navigate to second view
  
  new sap.ui.commons.Button(
  
  { "text": "Forward",
  
  press : function() {
   alert('Alert from Forward button' );
  
  sap.ui.getCore().byId("shell").removeAllWorksetItems();
 
 
 
  sap.ui.getCore().byId("shell").setContent(sap.ui.getCore().byId("idDisplayData1"),true);
 
   
  }

 

 

But my code is not working.Its showing the alert message but the page is not moving to the next view.

 

One more thing from where I can check the id of the view as for the initial view it get automatically defined in index.html but if I want to check the ID of other view from where I can check.


Viewing all articles
Browse latest Browse all 8124

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>