









/* Make Text Bold */
.Textbold{
font-weight: bold;
font-size: small;
color: red;
}

{
"listItems" : [
{
"title" : "Sales Reports",
"MATNR" : "000000000000202031",
"info" : "Overdue"
},
{
"title" : "Purchase Reports",
"MATNR" : "000000000000202033",
"info" : "Overdue",
"infoState" : "Error"
},
{
"title" : "Financial Reports",
"MATNR" : "000000000000202036",
"info" : "4 day ago"
}
]
}
var hostPort = "";
// this setting is required to test app with odataService in Eclipse environment
//hostPort = "proxy/http/<host>:<port>";
//Odata Service Path
var oDataPath = "/sap/opu/odata/sap/ZTEST_ODATA_SRV/";
// Odata Service Url
var serviceUrl= hostPort + oDataPath;

<!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
id="sap-ui-bootstrap"
src="resources/sap-ui-core.js"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-libs="sap.m, sap.ui.layout"
data-sap-ui-xx-bindingSyntax="complex"
data-sap-ui-resourceroots='{
"ZTEST_APP": "./"
}' >
</script>
<!-- Calling Componet-name of Component.js of UI5 -->
<script>
new sap.m.Shell({
app : new sap.ui.core.ComponentContainer({
name : "ZTEST_APP"
})
}).placeAt("content");
</script>
</head>
<body class="sapUiBody" id="content">
</body>
</html>
jQuery.sap.declare("ZTEST_APP.Component");
sap.ui.core.UIComponent.extend("ZTEST_APP.Component", {
metadata : {
stereotype : "component",
"abstract" : true,
version : "1.0",
library : "ZTEST_APP", //required for CSS reference
includes : [ "css/Styles.css" ], //CSS style reference
dependencies: { //external dependencies
libs : ["sap.m",
"sap.ui.commons",
"sap.ui.ux3",
"sap.ui.table",
"sap.ui.layout" ], //the libraries that component will be using
library : "sap.ui.core", //what library belongs your component to
},
},
createContent : function() {
// create root view
var oView = sap.ui.view({
id : "app",
viewName : "ZTEST_APP.view.App",
type : "JS",
viewData : { component : this }
});
// set device model
var deviceModel = new sap.ui.model.json.JSONModel({
isPhone : jQuery.device.is.phone,
listMode : (jQuery.device.is.phone) ? "None" : "SingleSelectMaster",
listItemType: (jQuery.device.is.phone) ? "Active" : "Inactive"
});
deviceModel.setDefaultBindingMode("OneWay");
oView.setModel(deviceModel, "device");
// done
return oView;
}
});
sap.ui.jsview("ZTEST_APP.view.App", {
getControllerName: function () {
return "ZTEST_APP.view.App";
},
createContent: function (oController) {
// to avoid scroll bars on desktop the root view must be set to block display
this.setDisplayBlock(true);
// create app
this.app = new sap.m.SplitApp();
// load the master page
var master = sap.ui.xmlview("Master", "ZTEST_APP.view.Master");
master.getController().nav = this.getController();
this.app.addPage(master, true);
// load the empty page
var empty = sap.ui.xmlview("Empty", "ZTEST_APP.view.Empty");
this.app.addPage(empty, false);
return this.app;
}
});sap.ui.controller("ZTEST_APP.view.App", {
/**
* Navigates to another page
* @param {string} pageId The id of the next page
* @param {sap.ui.model.Context} context The data context to be applied to the next page (optional)
*/
to : function (pageId, context) {
var app = this.getView().app;
// load page on demand
var master = ("Master" === pageId);
if (app.getPage(pageId, master) === null) {
var page = sap.ui.view({
id : pageId,
viewName: "ZTEST_APP.view." + pageId,
type : "XML"
});
page.getController().nav = this;
app.addPage(page, master);
jQuery.sap.log.info("app controller > loaded page: " + pageId);
}
// show the page
app.to(pageId);
// set data context on the page
if (context) {
var page = app.getPage(pageId);
page.setBindingContext(context);
}
},
/**
* Navigates back to a previous page
* @param {string} pageId The id of the next page
*/
back : function (pageId) {
this.getView().app.backToPage(pageId);
},
});<core:View
xmlns="sap.m"
xmlns:core="sap.ui.core" >
<Page>
<footer>
<Bar>
</Bar>
</footer>
</Page>
</core:View><core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m" controllerName="ZTEST_APP.view.Master" xmlns:html="http://www.w3.org/1999/xhtml">
<Page title="App Example">
<content>
<Bar>
<contentLeft>
<Button text="GetMaterial" press="pressGetMaterial" type="Accept" />
</contentLeft>
<contentRight>
<Button text="NextPage" press="pressNextPage" type="Emphasized" />
</contentRight>
</Bar>
<List id="idList1" mode="{device>/listMode}" items="{/listItems}">
<StandardListItem title="{MATNR}" />
</List>
</content>
<footer>
<Bar>
</Bar>
</footer>
</Page>
</core:View>
jQuery.sap.require("sap.m.MessageBox");
sap.ui.controller("ZTEST_APP.view.Master", {
pressNextPage: function(evt) {
//Navigation to detail page
var context = evt.getSource().getBindingContext();
this.nav.to("Details", context); //to() is defined in 'App.controller.js'
},
pressGetMaterial : function(evt) {
this.call_ModelFile();
},
call_ModelFile: function(){
//Calling model json file for data reference
var sample = $.sap.getModulePath("ZTEST_APP", "/model/sampleData.json");
var oModel = new sap.ui.model.json.JSONModel(sample);
//Set JSONModeloutput to ListControl
var list = this.getView().byId("idList1");
list.setModel(oModel);
}
});<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m" controllerName="ZTEST_APP.view.Details" xmlns:html="http://www.w3.org/1999/xhtml">
<Page title="Detail Page" showNavButton="true" navButtonPress="backPress">
<content>
<Label text="Welcome to Detail Page !!" design="Bold" />
</content>
<footer>
<Bar>
</Bar>
</footer>
</Page>
</core:View>sap.ui.controller("ZTEST_APP.view.Details", {
backPress : function (event) {
var context = event.getSource().getBindingContext();
if (!jQuery.device.is.phone){
this.nav.back("Empty", context);
}
this.nav.back("Master", context);
},
});

'You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 6 | |
| 6 | |
| 5 | |
| 5 | |
| 5 | |
| 4 | |
| 4 | |
| 4 | |
| 3 |