You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Step_2_Creating_a_Model_5278bfd.md
+37-37Lines changed: 37 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,48 +51,48 @@ In this tutorial, we will focus on JSON models since they are the simplest ones
51
51
52
52
You can view and download all files in the Demo Kit at [Data Binding - Step 2](https://sdk.openui5.org/entity/sap.ui.core.tutorial.databinding/sample/sap.ui.core.tutorial.databinding.02).
53
53
54
-
***
55
-
56
-
### webapp/index.js
57
-
58
-
```js
59
-
sap.ui.require([
60
-
"sap/m/Text",
61
-
"sap/ui/model/json/JSONModel"
62
-
], function (Text, JSONModel) {
63
-
"use strict";
64
-
65
-
// Attach an anonymous function to the SAPUI5 'init' event
66
-
sap.ui.getCore().attachInit(function () {
67
-
// Create a JSON model from an object literal
68
-
var oModel =newJSONModel({
69
-
greetingText:"Hi, my name is Harry Hawk"
70
-
});
71
-
72
-
// Assign the model object to the SAPUI5 core
73
-
sap.ui.getCore().setModel(oModel);
74
-
75
-
76
-
// Create a text UI element that displays a hardcoded text string
77
-
newText({text:"Hi, my name is Harry Hawk"}).placeAt("content");
78
-
});
79
-
});
54
+
1. Create a new folder named `model` in the `webapp` folder. In this folder, create a file called `data.json` with the following content:
55
+
56
+
**webapp/model/data.json**
57
+
58
+
```
59
+
{
60
+
"greetingText" : "Hi, my name is Harry Hawk"
61
+
}
62
+
```
63
+
64
+
2. Create a new JSON model in the `manifest.json` and set its path via a URI. This binds the model object to the app component and makes it globally available to all controls used within the application.
65
+
66
+
**manifest.json**
67
+
68
+
```
69
+
...
70
+
"sap.ui5": {
71
+
"dependencies": {
72
+
"minUI5Version": "1.120.0",
73
+
"libs": {
74
+
"sap.m": {},
75
+
"sap.ui.core": {},
76
+
"sap.ui.layout": {}
77
+
}
78
+
},
79
+
"models": {
80
+
"": {
81
+
"type": "sap.ui.model.json.JSONModel",
82
+
"uri": "./model/data.json"
83
+
}
84
+
},
85
+
...
86
+
```
87
+
88
+
89
+
Generally speaking, a model object holding business data should be bound to the app's `Component.js` or to the view that displays the data. For an example, see the Walkthrough tutorial, [Step 7: JSON Model](Step_7_JSON_Model_70ef981.md) \(binding to the View\) or [Step 9: Component Configuration](Step_9_Component_Configuration_4cfa608.md) \(binding to the Component\).
80
90
81
-
```
82
-
83
-
Create a new JSON model passing the data as object literal and store the resulting model instance in a local variable called `oModel`.
84
-
85
-
Set `oModel` to be the default model within the entire OpenUI5 core.
86
-
87
-
This makes the model object globally available to all controls used within the application.
88
-
89
-
In this case we have bound the model object to the OpenUI5 core. This has been done for simplicity, but is not considered good practice. Generally speaking, a model object holding business data should be bound to the app's `Component.js` or to the view that displays the data. For an example, see the Walkthrough tutorial, [Step 7: JSON Model](Step_7_JSON_Model_70ef981.md)\(binding to the View\) or [Step 9: Component Configuration](Step_9_Component_Configuration_4cfa608.md)\(binding to the Component\).
91
+
The text that is displayed on the UI is still hard-coded and not taken from the model - we will bind the property `greetingText` to our UI control in the next step.
90
92
91
93
> ### Note:
92
94
> Models can be set on every control by calling `setModel()`. The model is then propagated to all aggregated child controls \(and their children, and so on…\). All child control will then have access to that model
93
95
94
-
The text that is displayed on the UI is still hard-coded and not taken from the model - we will bind the property `greetingText` to our UI control in the next step.
95
-
96
96
**Parent topic:**[Data Binding Tutorial](Data_Binding_Tutorial_e531093.md "In this tutorial, we will explain the concepts of data binding in OpenUI5.")
97
97
98
98
**Next:**[Step 1: No Data Binding](Step_1_No_Data_Binding_4cde849.md "In this step, we create a basic application and simply place some text on the screen using a standard sap.m.Text control. The text in this control is a hard-coded part of the control's definition; therefore, this is not an example of data binding!")
Copy file name to clipboardExpand all lines: docs/Unit_Formatting_8e618a8.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -328,7 +328,7 @@ The third argument of the base Unit type constructor is a list of dynamic format
328
328
> ### Caution:
329
329
> **Legacy unit mapping is deprecated as of OpenUI5 1.122.0**
330
330
>
331
-
> With UI5 version 1.122.0, this map is no longer maintained; the state of this mapping is from UI5 version 1.119.0 and will remain for compatibility reasons only.
331
+
> With UI5 version 1.122.0, this map is no longer maintained; the state of this mapping corresponds to UI5 version 1.119.0.
332
332
333
333
With the upgrade of the CLDR version from 35.1 to 41, released with OpenUI5 version 1.110, some unit keys have changed. To support the formatting of legacy unit keys, a mapping has been added. A user is able to load legacy unit keys from his back end, which are then mapped to the new unit keys. When parsing user input, only the new unit keys are returned. Updating or changing entries containing legacy unit keys results in replacing the legacy unit key with a new unit key.
0 commit comments