Skip to Content
Author's profile photo Karthik Arjun

Navigate between two Views in SAPUI5 Using Destroy Method

Hi All,

In View Page 1 : Create one Button using below code

var butt = new sap.ui.commons.Button({

id : “id-butt”,

text : “Submit”,

press : oController.Submit

});

In Controller Page 1 :

Submit : function(){

//navigating between two views
var view1 = sap.ui.view({id:”idview12″, viewName:”sapui4_firstprogram.Vs”, type:sap.ui.core.mvc.ViewType.JS});//Initialize New View here
view1.placeAt(“content”);
var r = new sap.ui.getCore().byId(“idview11”);//By using this to call view 1
r.destroy();// Destroy the first View

}

Now First View will Destroy and you Can easy to navigate to Second View in a Single index Page…

Thanks,

Karthik A

Assigned Tags

      3 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi ,

      In order to navigate in a mobile application 'to' method can be used

      oApp.to(sap.ui.getCore().byId("MyView"))

      where oApp is our instance of sap.m.app.

      Regards,

      Vinuta

      Author's profile photo Former Member
      Former Member

      How to navigate in desktop apps ?

      Author's profile photo Karthik Arjun
      Karthik Arjun
      Blog Post Author

      Hi Sakthivel Elango,

      It is one way of showing yur next screen...

      here i am replace views,use fr this method is to avoid unwanted memory in runtime...

      it s an idea to use destroy concept...

      what Vinuta tld tat s another method to call other views...

      thank you Vinyta

      Thanks,
      Karthik A