Created
February 21, 2020 05:17
-
-
Save sodogan/c284847325c7132789646e25a58f5333 to your computer and use it in GitHub Desktop.
First SAPUI5 // source https://jsbin.com/vixilub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta charset="utf-8" /> | |
<head> | |
<script | |
id="sap-ui-bootstrap" | |
type="text/javascript" | |
src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js" | |
data-sap-ui-theme="sap_bluecrystal" | |
data-sap-ui-libs="sap.m" | |
data-sap-ui-compatVersion="edge" | |
data-sap-ui-async="true" | |
data-sap-ui-frameOptions="trusted" | |
></script> | |
<title>First SAPUI5</title> | |
<script> | |
let newButton = title => { | |
var btn_Settings = { | |
text: title, | |
type: sap.m.ButtonType.Accept, | |
icon: "sap-icon://action", | |
press: function() { | |
alert("Hello World!"); | |
} | |
}; | |
return new sap.m.Button(btn_Settings); | |
}; | |
//Callback here | |
let init_callback = () => { | |
var app = new sap.m.App("myApp", { | |
initialPage: "overviewPage" | |
}); | |
var overviewPage = new sap.m.Page("overviewPage", { | |
title: "Overview", | |
showNavButton: false, | |
subHeader: new sap.m.Bar({ | |
contentLeft: [newButton("left")], | |
contentMiddle: [newButton("middle")], | |
contentRight: [newButton("right")] | |
}), | |
headerContent: newButton("left"), | |
footer: new sap.m.Bar({ | |
contentLeft: [newButton("left")], | |
contentMiddle: [newButton("left")], | |
contentRight: [newButton("left")] | |
}) | |
}); | |
//add a page | |
var detailPage = new sap.m.Page("detailPage", { | |
title: "Detail Page", | |
showNavButton: true, | |
navButtonText: "Back", | |
navButtonPress: function() { | |
app.back(); | |
} | |
}); | |
app.addPage(overviewPage).addPage(detailPage); | |
//app.setInitialPage("listOverviewPage"); | |
app.placeAt("content"); | |
// footer: new sap.m.Bar({ | |
// design: sap.m.BarDesign.SubHeader, | |
// contentLeft: [ | |
// new sap.m.Button({ | |
// text: "This is ", | |
// icon: "sap-icon://nav-back" | |
// }) | |
// ], | |
// contentMiddle: [new sap.m.Text({ text: "This is Custom Header" })], | |
// contentRight: [ | |
// new sap.m.Button({ text: "smth", icon: "sap-icon://fallback" }) | |
// ] | |
//}) | |
// let btn_obj = new sap.m.Button(btn_Settings); | |
// for (let index = 0; index < 10; index++) { | |
// let id = `btn_${index}`; | |
// console.log(id); | |
// let btn_obj = new sap.m.Button(id, btn_Settings); | |
// btn_obj.setText(id); | |
// console.log(btn_obj); | |
// btn_obj.placeAt("content"); | |
// } | |
}; | |
//The initial load happens in here! | |
sap.ui.getCore().attachInit(init_callback); | |
</script> | |
</head> | |
<body> | |
<div id="content" class="sapUiBody"></div> | |
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html> | |
<html lang="en"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta charset="utf-8" /> | |
<head> | |
<script | |
id="sap-ui-bootstrap" | |
type="text/javascript" | |
src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js" | |
data-sap-ui-theme="sap_bluecrystal" | |
data-sap-ui-libs="sap.m" | |
data-sap-ui-compatVersion="edge" | |
data-sap-ui-async="true" | |
data-sap-ui-frameOptions="trusted" | |
><\/script> | |
<title>First SAPUI5</title> | |
<script> | |
let newButton = title => { | |
var btn_Settings = { | |
text: title, | |
type: sap.m.ButtonType.Accept, | |
icon: "sap-icon://action", | |
press: function() { | |
alert("Hello World!"); | |
} | |
}; | |
return new sap.m.Button(btn_Settings); | |
}; | |
//Callback here | |
let init_callback = () => { | |
var app = new sap.m.App("myApp", { | |
initialPage: "overviewPage" | |
}); | |
var overviewPage = new sap.m.Page("overviewPage", { | |
title: "Overview", | |
showNavButton: false, | |
subHeader: new sap.m.Bar({ | |
contentLeft: [newButton("left")], | |
contentMiddle: [newButton("middle")], | |
contentRight: [newButton("right")] | |
}), | |
headerContent: newButton("left"), | |
footer: new sap.m.Bar({ | |
contentLeft: [newButton("left")], | |
contentMiddle: [newButton("left")], | |
contentRight: [newButton("left")] | |
}) | |
}); | |
//add a page | |
var detailPage = new sap.m.Page("detailPage", { | |
title: "Detail Page", | |
showNavButton: true, | |
navButtonText: "Back", | |
navButtonPress: function() { | |
app.back(); | |
} | |
}); | |
app.addPage(overviewPage).addPage(detailPage); | |
//app.setInitialPage("listOverviewPage"); | |
app.placeAt("content"); | |
// footer: new sap.m.Bar({ | |
// design: sap.m.BarDesign.SubHeader, | |
// contentLeft: [ | |
// new sap.m.Button({ | |
// text: "This is ", | |
// icon: "sap-icon://nav-back" | |
// }) | |
// ], | |
// contentMiddle: [new sap.m.Text({ text: "This is Custom Header" })], | |
// contentRight: [ | |
// new sap.m.Button({ text: "smth", icon: "sap-icon://fallback" }) | |
// ] | |
//}) | |
// let btn_obj = new sap.m.Button(btn_Settings); | |
// for (let index = 0; index < 10; index++) { | |
// let id = `btn_${index}`; | |
// console.log(id); | |
// let btn_obj = new sap.m.Button(id, btn_Settings); | |
// btn_obj.setText(id); | |
// console.log(btn_obj); | |
// btn_obj.placeAt("content"); | |
// } | |
}; | |
//The initial load happens in here! | |
sap.ui.getCore().attachInit(init_callback); | |
<\/script> | |
</head> | |
<body> | |
<div id="content" class="sapUiBody"></div> | |
</body> | |
</html> | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment