-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathMain.controller.js
More file actions
33 lines (30 loc) · 1022 Bytes
/
Main.controller.js
File metadata and controls
33 lines (30 loc) · 1022 Bytes
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
sap.ui.define([
"ui5/challenge/controller/BaseController",
"sap/ui/model/json/JSONModel"
], function (
Controller,
JSONModel
) {
"use strict";
return Controller.extend("ui5.challenge.controller.Main", {
/**
* @override
*/
onInit: function () {
// var oModel = new JSONModel(sap.ui.require.toUrl("ui5/challenge/mockdata/products.json"));
// this.getView().setModel(oModel);
},
onButtonPress: function (oEvent) {
alert("Will be implemented soon ...");
},
onMyControlPress: function (oEvent) {
var oList = this.getView().byId("productsList");
var oSelectedItem = oList.getSelectedItem();
if (!oSelectedItem) {
this.getRouter().navTo("RouteDetail");
} else {
this.getRouter().navTo("RouteProductDetail", { "ProductID": oSelectedItem.getBindingContext().getProperty("ProductId") });
}
}
});
});