-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbindSelectList.js
41 lines (40 loc) · 1.05 KB
/
bindSelectList.js
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
setList: function(sPath, sList) {
var oViewModel = this.getModel("view");
var aItems = [];
this.getModel().read(sPath, {
success: function(oData, oResponse) {
if (sList === "/provinces") {
aItems = [{
ProvinceCode: "",
ProvinceName: "-- Select --",
CountryCode: ""
}];
} else if (sList === "/labourPackages") {
aItems = [{
LabourPackageCode: "",
LabourPackageDescription: "-- Select --",
Language: ""
}];
} else if (sList === "/workContracts") {
aItems = [{
WorkContractCode: "",
WorkContractDescription: "-- Select --",
CountryGroup: ""
}];
} else if (sList === "/compFrequencies") {
aItems = [{
Code: "",
Description: "-- Select --",
HourlyFlag: ""
}];
}
if (typeof oResponse.data.results !== "undefined") {
aItems = aItems.concat(oResponse.data.results);
}
oViewModel.setProperty(sList, aItems);
},
error: function(oError) {
console.log(oError);
}
});
}