From 4514324a58abf1622e5833329e886814f1d2b78e Mon Sep 17 00:00:00 2001 From: Marco Beier Date: Wed, 20 May 2020 19:12:11 +0200 Subject: [PATCH] Added everything for Step 4: Two-Way Data Binding --- webapp/controller/Home.controller.js | 8 ++++++-- webapp/view/Home.view.xml | 21 +++++++++++++-------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/webapp/controller/Home.controller.js b/webapp/controller/Home.controller.js index 50e9d53..f521217 100644 --- a/webapp/controller/Home.controller.js +++ b/webapp/controller/Home.controller.js @@ -8,11 +8,15 @@ sap.ui.define( return BaseController.extend("com.mrb.UI5-Data-Binding.controller.Home", { onInit: function () { + // Create a JSON model from an object literal var oModel = new JSONModel({ - greetingText: "Hi, my name is Marco", + firstName: "Harry", + lastName: "Hawk", + enabled: true, + panelHeaderText: "Data Binding Basics", }); - //Set model globally for all views/controls (dirty) "sap.ui.getCore().setModel(oModel);"" + //Set model globally for all views/controls (dirty) "sap.ui.getCore().setModel(oModel);"" //the go-to way for global definition would be to define the model within the manifest.json-file //and retrieve it via "this.getOwnerComponent().getModel();" this.getView().setModel(oModel); diff --git a/webapp/view/Home.view.xml b/webapp/view/Home.view.xml index 2a74f62..894c35a 100644 --- a/webapp/view/Home.view.xml +++ b/webapp/view/Home.view.xml @@ -1,10 +1,15 @@ - - - - - - + + + + + + \ No newline at end of file