-
Notifications
You must be signed in to change notification settings - Fork 82
/
TwoProperties.html
61 lines (54 loc) · 2.39 KB
/
TwoProperties.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
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html>
<html><head>
<meta http-equiv='X-UA-Compatible' content='IE=edge' />
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>
<title>Sorting and Grouping: Two Properties</title>
<script id='sap-ui-bootstrap' type='text/javascript'
src='/sapui5/latest/libs/resources/sap-ui-core.js'
data-sap-ui-theme='sap_bluecrystal'
data-sap-ui-libs='sap.m'></script>
<script>
var aBeerData = [
{ beerName: "Leffe Brune", beerType: "Belgian Brown Ale" },
{ beerName: "90 Minute IPA", beerType: "Imperial / Double IPA" },
{ beerName: "Turone Brune", beerType: "Belgian Brown Ale" },
{ beerName: "Extase", beerType: "Belgian IPA" },
{ beerName: "Landlord", beerType: "English Bitter" },
{ beerName: "Continuum", beerType: "English Bitter" },
{ beerName: "Yang", beerType: "Imperial / Double IPA" },
{ beerName: "Hoptimum 2013", beerType: "Imperial / Double IPA" },
{ beerName: "Nelson's Revenge", beerType: "English Bitter" }
];
var oModel = new sap.ui.model.json.JSONModel(aBeerData);
sap.ui.getCore().setModel(oModel);
var fGrouper = function(oContext) {
var sType = oContext.getProperty("beerType") || "Undefined";
return { key: sType, value: sType }
}
new sap.m.App({
pages: [
new sap.m.Page({
title: "Craft Beer",
content: [
new sap.m.List("list", {
items: {
path: '/',
template: new sap.m.StandardListItem({
title: "{beerName}",
description: "{beerType}"
}),
sorter: [
new sap.ui.model.Sorter("beerType", null, fGrouper),
new sap.ui.model.Sorter("beerName", null, null)
]
}
})
]
})
]
}).placeAt("content");
</script>
</head>
<body class='sapUiBody'><div id='content'></div>
</body>
</html>