-
Notifications
You must be signed in to change notification settings - Fork 82
/
OData_Tile.html
51 lines (46 loc) · 1.6 KB
/
OData_Tile.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>OData Tile Creation</title>
<script id="sap-ui-bootstrap"
src="../resources/sap-ui-core.js"
type="text/javascript"
data-sap-ui-libs="sap.m, sap.me"
data-sap-ui-theme="sap_bluecrystal">
</script>
<script type="text/javascript">
var sURI = "http://services.odata.org/Northwind/Northwind.svc/";
var oModel = new sap.ui.model.odata.ODataModel(sURI, true);
var oTileCont = new sap.m.TileContainer("tc",{});
//Tile Template
var oTileTmp = new sap.m.StandardTile({
icon : "sap-icon://menu",
title : "{CategoryName}",
info : "{Description}"
});
//Bind Categories use template to build tiles
oTileCont.bindAggregation("tiles","/Categories",oTileTmp);
// //alternate solution
// var oBinding = oModel.bindList("/Categories");
// var _handler = function() {
// $(oBinding.getContexts()).each(function(i, context){
// var oTile = new sap.m.StandardTile({
// icon : 'sap-icon://menu',
// title : oModel.getProperty("CategoryName", context),
// info : oModel.getProperty("Description", context)
// });
// oTileCont.addTile(oTile);
// });
// };
// oBinding.attachChange(_handler);
// oBinding.getContexts();
var page = new sap.m.Page({setShowHeader: true});
page.setEnableScrolling(false).setShowHeader(false).addContent(oTileCont);
var app = new sap.m.App();
app.addPage(page).setInitialPage(page.getId()).placeAt('body');
</script>
</head>
<body class="sapUiBody" id="body" role="application">
</body>
</html>