cancel
Showing results for 
Search instead for 
Did you mean: 

Fail to load view

0 Kudos

Hi ,

Just now i started UI5 Developments ,

i was doing shell, in the shell i created two work set  items whenever i selected workset items its has call view but its giving error.

var oshell = new sap.ui.ux3.Shell({

  

    appTitle: "NAPESCO",

  

    showSearchTool: false,

    content : [ new sap.ui.view (

  

    {

    id: "VIEW1", viewName : "expenserpt.exp_rpt",

    type : sap.ui.core.mvc.ViewType.JS

  

    }

  

    )],      

    worksetItems: [

                 

                  new sap.ui.ux3.NavigationItem("FI",{

                 

                  key: "FI",

                  text: "Finace",

                  subItems:[

                            new sap.ui.ux3.NavigationItem("EXP",{Key:"EXP",text:"Expense Report"})

                           

                           

                            ]

                  }),             

                 

                 

new sap.ui.ux3.NavigationItem("OFS",{

                 

                  key: "OFS",

                  text: "OFS(Oil Field Service)",

                  subItems:[new sap.ui.ux3.NavigationItem("OFS_1",{Key:"RIG",text:"RIG"}),

                            new sap.ui.ux3.NavigationItem("OFS_2",{Key:"RIG",text:"Well Program"})

                           

                            

                  ]

                 

                  })

                 

                 

                 

                  ],

 

                

   

   

    worksetItemSelected:function(oEvent)

    {

  

      var sID = oEvent.getParameter("key");

     

     

     

      switch(sID)

    {

     

    case"EXP":

         

    var view = oshell.sap.ui.ux3.getCore.byId(sID); 

    

      view = sap.ui.view({

     

      id: 'VIEW1', viewName:"expenserpt.exp_rpt", type:sap.ui.core.mvc.ViewType.JS});        

          this.addContent(view);      

           

     

    }

     

     

    },

                 

   

  

    });

  

  oshell.placeAt('container');

Accepted Solutions (1)

Accepted Solutions (1)

venkatachala_ck
Active Participant
0 Kudos

Hi Srinivas,

try this code

this code useful only when you want navigate between more than one view easily.

createContent : function(oController) {

  var view1 = sap.ui.view({id:"idHome11", viewName:"mymusic.Home", type:sap.ui.core.mvc.ViewType.JS});

  var view2 = sap.ui.view({id:"idHome22", viewName:"mymusic.DownloadPage", type:sap.ui.core.mvc.ViewType.JS});

  var song = new sap.ui.ux3.NavigationItem("songid11", {

  key:"btn",

  text:"Home"

  });

  var download = new sap.ui.ux3.NavigationItem("downloadid", {

  key:"music",

  text:"Down Load"

  });

  var oShell = new sap.ui.ux3.Shell({

  id:"mainshell",

  appTitle :"MUSIC WORLD",

  worksetItems:[song,download],

  content :view1,

  worksetItemSelected :function(oEvent){

  var id = oEvent.getParameter("id");

  var oShell = oEvent.getSource();

  switch(id){

  case 'songid11':

  oShell.addContent(view1);

  oShell.removeContent(view2);

  break;

  case 'downloadid':

  oShell.addContent(view2);

  oShell.removeContent(view1);

  }

  },

   

  } );

  return oShell;

  }

view1 and view2 are new new views you have to create first

Answers (2)

Answers (2)

Private_Member_15166
Active Contributor
0 Kudos

Check out this video. This will be very helpful as a fresher.

santhu_gowdaz
Active Contributor
0 Kudos

Why you are creating the view 2 times,

check out this working example here-Shell Example - SAPUI5 Demo Kit