Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 9169

Sapui5 splitapp pages and views

$
0
0

Hello experts,

 

I'm making a sapui5 splitapp so i started out with this:

----------------------------------------------------------------------------------------------------------------------

//SPLIT APP

  var oSplitApp = new sap.m.SplitApp("mySplitApp", {});

 

  var oDetailPage1 = new sap.m.Page("detail1", {

    title : "Detail 1",

    content : [ new sap.m.Label({

  text : "this is Detail 1"

                })

      ]

  });

 

 

  var oDetailPage2 = new sap.m.Page("detail2", {

    title : "Detail 2",

    content : [ new sap.m.Label({

  text : "this is Detail 2"

                })

      ]

  });

 

 

  var oMasterPage1 = new sap.m.Page("master1",{

    title : "Master1",

    navButtonPress : function() {

    oSplitApp.backMaster();

           },

    content : [ new sap.m.List({

  mode:"SingleSelectMaster",

  select: function(oEv) {

    if(oEv.getParameter("listItem").getId() == "listDetail2") {

       oSplitApp.toDetail("detail2");

  }else {

       oSplitApp.toDetail("detail1");

  }

  },

  items : [ new sap.m.StandardListItem("listDetail2",{

       title : "To Detail 2"

  }), new sap.m.StandardListItem("listDetail",{

      title : "To Detail 1"

  }) ]

  }) ]

  });

 

  //add the master pages to the splitapp control

  oSplitApp.addMasterPage(oMasterPage1);

 

 

  //add the detail pages to the splitapp control

  oSplitApp.addDetailPage(oDetailPage1).addDetailPage(oDetailPage2);

 

 

  //place

  oSplitApp.placeAt("content");

  </script>

 

 

  </head>

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

  <div id="content">

 

 

  </div>

  </body>

</html>

----------------------------------------------------------------------------------------------------------------------

 

So my question here is should i still use views ? Or am i supposed to code everything in the index.html file ?

 

Can i use this for example:

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

 

Kind regards,

 

Bart


Viewing all articles
Browse latest Browse all 9169

Trending Articles