Skip to content

Instantly share code, notes, and snippets.

@Devaarth
Created May 19, 2016 07:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Devaarth/870c8c81872cbd9b0817a438c67c1bc9 to your computer and use it in GitHub Desktop.
Save Devaarth/870c8c81872cbd9b0817a438c67c1bc9 to your computer and use it in GitHub Desktop.
SplitApp_test
sap.ui.controller("testsplitapp_1.DetailsView", {
/**
* Called when a controller is instantiated and its View controls (if available) are already created.
* Can be used to modify the View before it is displayed, to bind event handlers and do other one-time initialization.
* @memberOf testsplitapp_1.DetailsView
*/
// onInit: function() {
//
// },
/**
* Similar to onAfterRendering, but this hook is invoked before the controller's View is re-rendered
* (NOT before the first rendering! onInit() is used for that one!).
* @memberOf testsplitapp_1.DetailsView
*/
// onBeforeRendering: function() {
//
// },
/**
* Called when the View has been rendered (so its HTML is part of the document). Post-rendering manipulations of the HTML could be done here.
* This hook is the same one that SAPUI5 controls get after being rendered.
* @memberOf testsplitapp_1.DetailsView
*/
// onAfterRendering: function() {
//
// },
/**
* Called when the Controller is destroyed. Use this one to free resources and finalize activities.
* @memberOf testsplitapp_1.DetailsView
*/
// onExit: function() {
//
// }
});
sap.ui.jsview("testsplitapp_1.DetailsView", {
/** Specifies the Controller belonging to this View.
* In the case that it is not implemented, or that "null" is returned, this View does not have a Controller.
* @memberOf testsplitapp_1.DetailsView
*/
getControllerName : function() {
return "testsplitapp_1.DetailsView";
},
/** Is initially called once after the Controller has been instantiated. It is the place where the UI is constructed.
* Since the Controller is given to this method, its event handlers can be attached right away.
* @memberOf testsplitapp_1.DetailsView
*/
createContent : function(oController) {
return new sap.m.Page({
title: "Title",
content: [
]
});
}
});
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>
<script src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.m"
data-sap-ui-theme="sap_bluecrystal">
</script>
<!-- only load the mobile lib "sap.m" and the "sap_bluecrystal" theme -->
<script>
sap.ui.localResources("testsplitapp_1");
var app = new sap.m.SplitApp("splitApp",{mode: sap.m.SplitAppMode.ShowHideMode});
var master = sap.ui.view({id:"master", viewName:"testsplitapp_1.MasterView", type:sap.ui.core.mvc.ViewType.JS});
app.addMasterPage(master);
var details = sap.ui.view({id:"details", viewName:"testsplitapp_1.DetailsView", type:sap.ui.core.mvc.ViewType.JS});
app.addDetailPage(details);
app.placeAt("content");
</script>
</head>
<body class="sapUiBody" role="application">
<div id="content"></div>
</body>
</html>
sap.ui.controller("testsplitapp_1.MasterView", {
/**
* Called when a controller is instantiated and its View controls (if available) are already created.
* Can be used to modify the View before it is displayed, to bind event handlers and do other one-time initialization.
* @memberOf testsplitapp_1.MasterView
*/
onInit: function() {
var sUrl = "http://services.odata.org/Northwind/Northwind.svc/Categories";
var omodel = new sap.ui.model.json.JSONModel(sUrl);
sap.ui.getCore().byId("list").setModel(omodel);
},
/**
* Similar to onAfterRendering, but this hook is invoked before the controller's View is re-rendered
* (NOT before the first rendering! onInit() is used for that one!).
* @memberOf testsplitapp_1.MasterView
*/
// onBeforeRendering: function() {
//
// },
/**
* Called when the View has been rendered (so its HTML is part of the document). Post-rendering manipulations of the HTML could be done here.
* This hook is the same one that SAPUI5 controls get after being rendered.
* @memberOf testsplitapp_1.MasterView
*/
// onAfterRendering: function() {
//
// },
/**
* Called when the Controller is destroyed. Use this one to free resources and finalize activities.
* @memberOf testsplitapp_1.MasterView
*/
// onExit: function() {
//
// }
});
sap.ui.jsview("testsplitapp_1.MasterView", {
/** Specifies the Controller belonging to this View.
* In the case that it is not implemented, or that "null" is returned, this View does not have a Controller.
* @memberOf testsplitapp_1.MasterView
*/
getControllerName : function() {
return "testsplitapp_1.MasterView";
},
/** Is initially called once after the Controller has been instantiated. It is the place where the UI is constructed.
* Since the Controller is given to this method, its event handlers can be attached right away.
* @memberOf testsplitapp_1.MasterView
*/
createContent : function(oController) {
oListCategory =new sap.m.List("list",{
includeItemInSelection : true,
inset : true
}),
oTemplate = new sap.m.StandardListItem("idItems",{
title:"{CategoryName}",
description :"{Description}",
type: sap.m.ListType.Navigation,
}),
oListCategory.bindAggregation("items",{
path : "/value",
template: oTemplate
})
return new sap.m.Page({
title: "Title",
content: [ oListCategory ]
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment