Skip to content

Instantly share code, notes, and snippets.

@dennisseah
Created August 28, 2014 07:32
Show Gist options
  • Save dennisseah/b2e101a2cd6fbed4a686 to your computer and use it in GitHub Desktop.
Save dennisseah/b2e101a2cd6fbed4a686 to your computer and use it in GitHub Desktop.
SAPUI5: sap.m.ActionSheet on Desktop
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<script id="sap-ui-bootstrap"
type="text/javascript"
data-sap-ui-libs="sap.ui.table,sap.ui.commons,sap.m"
data-sap-ui-theme="sap_bluecrystal"
src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js">
</script>
<script>
$(function() {
function createBtn(text, icon) {
var btn = new sap.m.Button({
text: text,
press: function() {
sap.m.MessageToast.show(this.getText() + ' is clicked');
}
}).addStyleClass('sapUiSizeCompact');
if (icon) {
btn.setIcon("sap-icon://" + icon);
}
return btn;
}
var actionSheet = new sap.m.ActionSheet({
title:"Choose Your Action",
showCancelButton: true,
placement:"Bottom",
buttons: [
createBtn('Reject', 'decline'),
createBtn('Accept', 'accept'),
createBtn('Email', 'email'),
createBtn('Forward', 'forward'),
createBtn('Delete', 'delete'),
createBtn('Other')
]
}).addStyleClass('sapUiSizeCompact');
var btn = new sap.m.Button({
text: 'Open',
press: function() {
actionSheet.openBy(this);
}
}).addStyleClass('sapUiSizeCompact');;
btn.placeAt('content');
});
</script>
</head>
<body class="sapUiBody">
<div id="content"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment