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
| sap.ui.define([ "sap/ui/core/mvc/Controller", "sap/ui/model/json/JSONModel", "sap/m/MessageToast", ], function (Controller, JSONModel,MessageToast) { "use strict"; return Controller.extend("project2.controller.FirstView", {
onInit: function () { var jsonData = { "process": [{ "Code": "0", "ProcName": "process1" }, { "Code": "1", "ProcName": "process2" } ], "process1": [{ "Code": "2", "ProcName": "process3" }, { "Code": "3", "ProcName": "process4" } ] }; var oViewModel = new JSONModel(jsonData); this.getView().setModel(oViewModel); }, onProcessChange: function(oEvent){ this.process = oEvent.getSource().getSelectedKey(); switch (this.process) { case "0": MessageToast.show(this.process); case "1": MessageToast.show(this.process); break; } }, onProcessChange1: function(oEvent){ this.process = oEvent.getSource().getSelectedKey(); switch (this.process) { case "2": MessageToast.show(this.process); case "3": MessageToast.show(this.process); break; } } }); });
|