-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRelationshipsList.html
180 lines (156 loc) · 6.94 KB
/
RelationshipsList.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>SAPUI5 single file template | nabisoft</title>
<!-- decide what version you want to use, see http://scn.sap.com/community/developer-center/front-end/blog/2015/07/30/multi-version-availability-of-sapui5:
<script src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
<script src="https://sapui5.hana.ondemand.com/1.28.28/resources/sap-ui-core.js"
<script src="https://openui5beta.hana.ondemand.com/resources/sap-ui-core.js"
<script src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js"
<script src="https://openui5.hana.ondemand.com/1.36.12/resources/sap-ui-core.js"
-->
<script src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-libs="sap.m"
data-sap-ui-bindingSyntax="complex"
data-sap-ui-compatVersion="edge"
data-sap-ui-preload="async"></script>
<!-- use "sync" or change the code below if you have issues -->
<!-- XMLView -->
<script id="myXmlView" type="ui5/xmlview">
<mvc:View
height="100%"
controllerName="sap.m.sample.ComboBoxLazyLoading.Page"
xmlns:core="sap.ui.core"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m">
<Page showHeader="false">
<content>
<ComboBox
items="{
path: "/EmployeeListInput(ipv_active_flag='Y')/Results",
sorter: { path: 'formatted_name' },
suspended: true
}"
loadItems="handleLoadItems">
<core:ListItem key="{employee_ba_id}" text="{employee_name}"/>
</ComboBox>
</content>
</Page>
</mvc:View>
</script>
<!-- XML Fragment -->
<script id="myXMLFragment" type="ui5/fragment">
<core:FragmentDefinition
xmlns="sap.m"
xmlns:core="sap.ui.core">
<ColumnListItem type="Active">
<cells>
<ObjectIdentifier title="{}"/>
<Text text="{client_name}"/>
<Text text="{project_name}"/>
<Text text="{value}"/>
</cells>
</ColumnListItem>
</core:FragmentDefinition>
</script>
<script>
sap.ui.getCore().attachInit(function () {
"use strict";
//### Controller ###
sap.ui.define([
"sap/ui/core/mvc/Controller",
"sap/ui/model/json/JSONModel",
"sap/ui/model/odata/v2/ODataModel",
"sap/m/MessageBox"
], function (Controller, JSONModel, ODataModel, MessageBox) {
"use strict";
return Controller.extend("MyController", {
onInit : function () {
var oViewModel = new JSONModel({
tableTitle: "Projects",
numProjs: 0
});
this.getView().setModel(
new ODataModel("https://rhddba01:4300/graham_app/client/services/client.xsodata/", {
json : true,
useBatch : true
})
);
var sPath = "/ClientProjectListInput(5402)/Results";
//var oTable = this.byId("myTable");
var oTemplate = sap.ui.xmlfragment({
fragmentContent : jQuery("#myXMLFragment").html()
});
//var oSorter = new sap.ui.model.Sorter("stage", false)
/*oTable.bindAggregation("items", {
path: sPath,
template: new sap.m.ColumnListItem({
cells: [
new sap.m.Label({
text: "{stage}",
design: "Bold"
}),
new sap.m.Text({
text: "{project_name}"
}),
new sap.m.Text({
text: "{value}"
})
]
}),
sorter: oSorter
});*/
//oTable.bindItems(sPath, oTemplate, null /*oSorter*/, null /*aFilters*/);
this.getView().setModel(oViewModel, "view");
},
onUpdateFinished: function(oEvent) {
var sTitle,
oTable = oEvent.getSource(),
iTotalItems = oEvent.getParameter("total");
var sTableName = oTable.sId.split("-").pop();
if (iTotalItems && oTable.getBinding("items").isLengthFinal()) {
sTitle = "Projects (" + iTotalItems + ")";
} else {
sTitle = "Projects";
}
this.getView().getModel("view").setProperty("/tableTitle", sTitle);
this.getView().getModel("view").setProperty("/numProjs", iTotalItems);
},
handleLoadItems: function(oControlEvent) {
oControlEvent.getSource().getBinding("items").resume();
},
_submitUser: function() {
var oModel = this.getView().getModel();
var mNewEntry = {};
mNewEntry.id = 0;
mNewEntry.ba_id = 275467;
mNewEntry.note_type_id = this.byId("sType").getValue();;
mNewEntry.note_date = "/Date(872850505000)/";
mNewEntry.note_text = this.byId("sText").getValue();
mNewEntry.revision_date = new Date();
mNewEntry.revision_user = "timmo";
oModel.create("/BaNote", mNewEntry, null, function() {
MessageBox.success("User Added Sucessfully");
}, function() {
MessageBox.warning("Please Check Record");
});
oModel.refresh();
var oTable = this.byId("myTable");
oTable.getBinding("items").refresh();
}
});
});
//### THE APP: place the XMLView somewhere into DOM ###
sap.ui.xmlview({
viewContent : jQuery("#myXmlView").html()
}).placeAt("content");
});
</script>
</head>
<body class="sapUiBody">
<div id="content"></div>
</body>
</html>