Skip to content

Commit

Permalink
OpenUI5 Documentation Update 22.10.2024
Browse files Browse the repository at this point in the history
  • Loading branch information
openui5bot committed Oct 22, 2024
1 parent 09598a9 commit 7084951
Show file tree
Hide file tree
Showing 27 changed files with 307 additions and 392 deletions.
2 changes: 1 addition & 1 deletion docs/0index.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ OpenUI5 Version for the OpenUI5 Demo Kit
- [Step 7: Changing the Table to a Growing Table](Step_7_Changing_the_Table_to_a_Growing_Table_016e0d4.md)
- [Step 8: Testing Navigation](Step_8_Testing_Navigation_10592af.md)
- [Step 9: Adding the Post Page](Step_9_Adding_the_Post_Page_4a9f063.md)
- [Step 10: Test Suite and Automated Testing](Step_10_Test_Suite_and_Automated_Testing_07c97a2.md)
- [Step 10: Automated Testing](Step_10_Automated_Testing_07c97a2.md)
- [Step 11: Testing User Input](Step_11_Testing_User_Input_92959b1.md)
- [Step 12: Adding a Search](Step_12_Adding_a_Search_0c270b4.md)
- [Step 13: Testing User Interaction](Step_13_Testing_User_Interaction_19ccd47.md)
Expand Down
4 changes: 4 additions & 0 deletions docs/Batch_Control_74142a3.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ A group ID has one of the following [submit modes](https://sdk.openui5.org/api/s
- `sap.ui.model.odata.v4.SubmitMode.Direct` - Requests associated with the group ID are sent directly without batch. Note that some features of the OData V4 model rely on the correct order of request processing in the back end. This is only guaranteed for requests made in batch requests.


> ### Note:
> We recommend using either`sap.ui.model.odata.v4.SubmitMode.API` or `sap.ui.model.odata.v4.SubmitMode.Auto` groups in productive applications as not all features of the OData V4 model work without batch requests.
The following group IDs are possible:

- `"$auto"` and `"$auto.*"`: Predefined batch group ID which is the default if no group ID is specified. You can use different `$auto.*` group IDs to use different batch requests. The suffix can be any non-empty string consisting of alphanumeric characters from the basic Latin alphabet, including the underscore. They have the submit mode `sap.ui.model.odata.v4.SubmitMode.Auto`.
Expand All @@ -44,6 +47,7 @@ The following group IDs are possible:

- An application group ID is a non-empty string consisting of alphanumeric characters from the basic Latin alphabet, including the underscore. By default, an application group has the submit mode `sap.ui.model.odata.v4.SubmitMode.API`. It is possible to use a different submit mode; for details see section [Define submit mode for an application group ID](Batch_Control_74142a3.md#loio74142a38e3d4467c8d6a70b28764048f__section_e1x_pfg_1cb).

- With [`sap.ui.model.odata.v4.Context#delete`](https://sdk.openui5.org/api/sap.ui.model.odata.v4.Context%23methods/delete), [`sap.ui.model.odata.v4.ODataModel#delete`](https://sdk.openui5.org/api/sap.ui.model.odata.v4.ODataModel%23methods/delete), and [`sap.ui.model.odata.v4.ODataContextBinding#execute`](https://sdk.openui5.org/api/sap.ui.model.odata.v4.ODataContextBinding%23methods/execute), you can also use the `$single` group ID. With this group ID, a single batch request is sent directly, similar to `sap.ui.model.odata.v4.SubmitMode.Direct` groups.

To specify the group ID for implicit requests, use the parameters `$$groupId` \(group ID for read requests\) and `$$updateGroupId` \(group ID for update requests\) for the binding which initiates the request \(see the [ODataModel.bindList](https://sdk.openui5.org/api/sap.ui.model.odata.v4.ODataModel/methods/bindList), [ODataModel.bindContext](https://sdk.openui5.org/api/sap.ui.model.odata.v4.ODataModel/methods/bindContext) and [ODataModel.bindProperty](https://sdk.openui5.org/api/sap.ui.model.odata.v4.ODataModel/methods/bindProperty) API documentation\).

Expand Down
48 changes: 48 additions & 0 deletions docs/Changes_Compared_to_OData_V2_Model_abd4d7c.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,54 @@ For more information, see [Type Determination](Type_Determination_53cdd55.md).
</td>
</tr>
<tr>
<td valign="top">
There is no `AnalyticalBinding` and no `ODataTreeBinding` available. Data aggregation and recursive hierarchy support are available with the `sap.ui.model.odata.v4.ODataListBinding` using the `$$aggregate` binding parameter and the related [`sap.ui.model.odata.v4.ODataListBinding#setAggregation`](https://sdk.openui5.orgapi/sap.ui.model.odata.v4.ODataListBinding/methods/setAggregation) method.
</td>
<td valign="top">
Aggregated data as well as hierarchical data is displayed in a table or list. As a result, the interface of the table or list control and the list binding is reused and enhanced without providing new binding classes. This allows to reuse functionality of the `sap.ui.model.odata.v4.ODataListBinding`.
</td>
</tr>
<tr>
<td valign="top">
There is no global cache of entities. Instead, data is kept with respect to bindings and different data for the same entity may be displayed. As a consequence, it is important to use relative bindings as described in [Data Reuse](Data_Reuse_648e360.md) if the same data should be displayed.
</td>
<td valign="top">
It is now possible to show different states of the same entity, e.g. to allow comparison between the data states before and after a change.
</td>
</tr>
<tr>
<td valign="top">
A selection is managed by the `ODataModel` and not by the table.
</td>
<td valign="top">
The `ODataModel` is responsible for fetching data for the client and caching data on the client. It is important for the model to know which records are selected, so that the respective `sap.ui.model.odata.v4.Context` instances remain available. Also, possible future improvements require the handling of record selection in the `ODataModel`.
</td>
</tr>
<tr>
<td valign="top">
Data of selected contexts may not be available synchronously.
</td>
<td valign="top">
In applications, a user may continue editing after selecting a record. This might cause side effects; see [`sap.ui.model.odata.v4.Context#requestSideEffects`](https://sdk.openui5.orgapi/sap.ui.model.odata.v4.Context%23methods/requestSideEffects). The user may also refresh, change, sort, or filter. In all these cases, the expectation is that the client shows up-to-date data. For selected contexts, this means that, instead of keeping their data up to date all the time, their data needs to be accessed asynchronously when needed.
</td>
</tr>
</table>
Expand Down
3 changes: 2 additions & 1 deletion docs/Concept_and_Basic_Setup_22f50c0.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ The `tests` object is empty for now. For more information on how to add a define

### The Generic Test Page

The generic test page runs one or multiple test modules. Typically, this file is named `test.qunit.html`. The generic test page is configured in the test suite module. It will be called with the test suite and test name in order to run a test.
The generic test page runs one or multiple test modules. Typically, this file is named `Test.qunit.html`. The generic test page is configured in the test suite module. It will be called with the test suite and test name in order to run a test.

```
Expand All @@ -123,5 +123,6 @@ The generic test page runs one or multiple test modules. Typically, this file is
<div id="qunit"></div>
<div id="qunit-fixture"></div>
</body>
</html>
```

10 changes: 0 additions & 10 deletions docs/Configuration_Options_738ed02.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,6 @@ The following options are available on the `defaults` and the individual test co
},
/*
* Whether the UI5 Core (sap/ui/core/Core.js) should be required and booted.
*
* When this option is true, the Core is not only loaded and started, but loading and execution
* of the test module(s) is also delayed until the Promise resolves which is returned from Core.ready()
* ("Core" required from module "sap/ui/core/Core").
*/
bootCore: true,
/*
* Whether the test starter should call QUnit.start() after all prerequisites have been fulfilled
* (e.g. QUnit, Sinon, a bridge, have been loaded, coverage tooling has been loaded and configured,
Expand Down
6 changes: 2 additions & 4 deletions docs/Data_Aggregation_and_Recursive_Hierarchy_7d91431.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ Since 1.117.0, either a read-only recursive hierarchy \(see below\) or \(pure\)

### Data Aggregation

For every aggregatable property, you can provide the name of the custom aggregate for a corresponding currency or unit of measure. That custom aggregate must return the single value of a unit in case there is only one, or `null` otherwise \("multi-unit situation"\). For SQL-based services, this might be implemented as follows:

`CASE WHEN min(Unit) = max(Unit) THEN min(Unit) END`
For every aggregatable property, you can provide the name of the custom aggregate for a corresponding currency or unit of measure. That custom aggregate must return the single value of a unit in case there is only one, or `null` otherwise \("multi-unit situation"\). In the special case that the single value is `null`, an empty string `""` has to be returned.

Normally, there is also a structural property of the same name as the custom aggregate, providing type information, etc. In case of a multi-unit situation, [`v4.Context#getFilter`](https://sdk.openui5.orgapi/sap.ui.model.odata.v4.Context%23methods/getFilter) may be helpful to send a request for more details.

Expand Down Expand Up @@ -190,7 +188,7 @@ The `@$ui5.node.level` and `@$ui5.node.isExpanded` client-side instance annotati
Since 1.125.0, a recursive hierarchy need not be read-only, but maintenance is supported, namely:
- **Update of arbitrary properties**, including any corresponding side effects. Note that a side-effects refresh needs to be requested explicitly if the change affects the hierarchy \(node IDs, parent/child relations, or sibling order\); this is not done by the model itself.
- **Creation of new nodes**, either as new root nodes or below an existing parent node. Creation is even supported if the parent was a leaf before, however it is not supported for a collapsed parent.For more details, see [`v4.ODataListBinding#create`](https://sdk.openui5.orgapi/sap.ui.model.odata.v4.ODataListBinding/methods/create) and "`@$ui5.node.parent`" therein. Unless the `createInPlace` parameter is used, a newly created node is displayed even if it does not match current filters, and it is always shown in the first position among its siblings, independent of the current sort order or its real back-end position; this is called "out of place".
- **Creation of new nodes**, either as new root nodes or below an existing parent node. Creation is even supported if the parent was a leaf before, however it is not supported for a collapsed parent.For more details, see [`v4.ODataListBinding#create`](https://sdk.openui5.orgapi/sap.ui.model.odata.v4.ODataListBinding/methods/create) and "`@$ui5.node.parent`" therein. Since 1.130.0, the `createInPlace` option is supported for the`$$aggregation` binding parameter and the [`v4.ODataListBinding#setAggregation`](https://sdk.openui5.orgapi/sap.ui.model.odata.v4.ODataListBinding%23methods/setAggregation) method. When set, newly created nodes are shown "in place", i.e. at the position specified by the service . Otherwise, created nodes are displayed out of place as the first children of their parent or as the first roots, but not in their usual position as defined by the service and the current sort order.
- **Deletion of existing nodes**; see [`v4.Context#delete`](https://sdk.openui5.orgapi/sap.ui.model.odata.v4.Context/methods/delete). Note that the deletion is first done on the server and only later shown on the client. Thus, the group ID must not have submit mode "API".
- **Moving of nodes**. You can change the parent node, including turning a child node into a root node and vice versa, and you can also change the sibling position, including making a node the last one among its siblings or moving it just before a specified sibling. For more details, see [`v4.Context#move`](https://sdk.openui5.orgapi/sap.ui.model.odata.v4.Context/methods/move). Note that `nextSibling` requires a ["com.sap.vocabularies.Hierarchy.v1.RecursiveHierarchyActions"](https://github.com/SAP/odata-vocabularies/blob/main/vocabularies/Hierarchy.md#RecursiveHierarchyActions) annotation with at least a `ChangeNextSiblingAction`. An out-of-place node has no preceding sibling and thus cannot be moved up. Each out-of-place node with the same parent has the same following sibling, namely that parent's first in-place \(that is, not out-of-place\) node; that following sibling is `null` if the parent has no in-place children. A similar consideration applies for out-of-place root nodes. This way, you can move out-of-place nodes down so that they become in-place nodes; thus, you actively determine their position among their siblings. A first in-place node has no preceding sibling even if out-of-place nodes are present; thus, an in-place node cannot be moved up in order to become out-of-place \(again\).
Expand Down
40 changes: 22 additions & 18 deletions docs/Expression_Binding_daf6852.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,34 @@ An expression binding is specified in an XML view by one of the following two op

The syntax of the `expression` is similar to JavaScript syntax, but you can only use a subset of the JavaScript expression syntax as defined in the table below. Additionally, you can embed values from the model layer into an expression as additional bindings by using one of the following syntaxes:

- <code>%{<b>binding</b>}</code>

- <code>${<b>binding</b>}</code>

- <code>%{<b>binding</b>}</code>

`binding` can either be a simple path or a complex binding. The embedded binding <code>${<b>binding</b>}</code> delivers a value formatted according to the target type of the control property the expression binding applies to, for example `boolean` in case of `<Icon src="sap-icon://message-warning" visible="{= ${status} === 'critical' }">`. This can be undesirable or even lead to errors, for example if OData V4 automatically adds the correct type for the `status` property, which is string-like, not boolean. For expression bindings, we therefore recommend to use the syntax `%{binding}` by default, which is just a shortcut for `${path : 'binding', targetType : 'any'}`. In rare cases, you might also want to specify a different `targetType`, for example `string`, `boolean`, `int` or `float`.

For more information how these values relate to OData types, see the [`sap.ui.model.odata.type`](https://sdk.openui5.org/api/sap.ui.model.odata.type) API documentation or explore the [XML Templating: UI5 OData Types](https://sdk.openui5.org/entity/sap.ui.core.mvc.XMLView/sample/sap.ui.core.sample.ViewTemplate.types) sample in the Demo Kit.

`binding` can either be a simple path, or a complex binding. The embedded binding <code>${<b>binding</b>}</code> delivers a value formatted according to the target type of the control property the expression binding applies to, for example, “boolean” in case of `<Icon src="sap-icon://message-warning" visible="{= ${status} === 'critical' }">`. This can be undesirable or even lead to errors, for example, if OData V4 automatically adds the correct type for the “status” property which is string-like, not boolean. In such cases, use the syntax `%{binding}` instead. It is just a shortcut for `${path : 'binding', targetType : 'any'}`. In rare cases, you might also want to specify a different “targetType”, for example “string”, “boolean”, “int” or “float”. For more information how these values relate to OData types, see the [sap.ui.model.odata.type](https://sdk.openui5.org/api/sap.ui.model.odata.type) API documentation or explore the [XML Templating: UI5 OData Types](https://sdk.openui5.org/entity/sap.ui.core.mvc.XMLView/sample/sap.ui.core.sample.ViewTemplate.types) sample in the Demo Kit. For more information about `targetType`, see the [sap.ui.base.ManagedObject\#bindProperty](https://sdk.openui5.org/api/sap.ui.base.ManagedObject/methods/bindProperty) API documentation in the Demo Kit.
For more information about `targetType`, see the [sap.ui.base.ManagedObject\#bindProperty](https://sdk.openui5.org/api/sap.ui.base.ManagedObject/methods/bindProperty) API documentation in the Demo Kit.

> ### Note:
> Expression binding can also be used with JavaScript. For example:
>
> ```js
> new Text({"visible" : "{= ${status} === 'critical' && ${amount} > 10000 }"});
> new Text({"visible" : "{= %{status} === 'critical' && %{amount} > 10000 }"});
> ```
>
> or
>
> ```js
> new Icon({color : "'{= encodeURIComponent(${/ID}) }'"});
> new Icon({color : "'{= encodeURIComponent(%{/ID}) }'"});
> ```
> ### Note:
> An expression binding does **not** validate binding paths. As a result, an expression binding will **not** detect incorrect or misspelled binding paths. But if you use an OData V4 model and try to bind data that does **not** exist in the model, a warning is logged in the console.
To embed a path containing a closing curly brace into an expression binding, use a complex binding syntax: `${path:'...'}`, for example `"{:= ${path:'target>extensions/[${name} === \'semantics\']/value'} === 'email'}"`. You can use this also to avoid variable replacement by build tools like Maven for special names like Description or Name.
To embed a path containing a closing curly brace into an expression binding, use a complex binding syntax: `%{path:'...'}`, for example `"{:= %{path:'target>extensions/[${name} === \'semantics\']/value'} === 'email'}"`. You can use this also to avoid variable replacement by buildtools like Maven for special names like "Description" or "Name".
<table>
Expand Down Expand Up @@ -217,7 +221,7 @@ Member access operator with the `.` operator
> ### Note:
> With these, you can use members and member methods on standard types such as string, array, number, and so on.
>
> Example: `${message>/}.length >0` or `${/firstName}.indexOf('S')`.
> Example: `%{message>/}.length >0` or `%{/firstName}.indexOf('S')`.
Expand All @@ -235,7 +239,7 @@ Function call
Example:
<code>• text="{= <b>Math.max(${/value1}, ${/value2}, ${/value3})</b> }"</code>
<code>• text="{= <b>Math.max(%{/value1}, %{/value2}, %{/value3})</b> }"</code>
> ### Note:
> You can use functions that are available via global symbols, such as `Math.max(...)` or `isNaN(...)`.
Expand Down Expand Up @@ -347,7 +351,7 @@ When using expression binding, however, you only need the XML view without contr
<mvc:View controllerName="sample.app" xmlns="sap.ui.core" xmlns:mvc="sap.ui.core.mvc">
...
<Icon src="sap-icon://message-warning" visible="{= ${status} === 'critical' }">
<Icon src="sap-icon://message-warning" visible="{= %{status} === 'critical' }">
...
</mvc:View>
Expand Down Expand Up @@ -378,40 +382,40 @@ Examples for more complex expressions:
<!-- Set to visible if the status is critical and the amount
is above the threshold (note escaping of &&). -->
visible="{= ${status} === 'critical' &amp;&amp; ${amount} > 10000 }"
visible="{= %{status} === 'critical' &amp;&amp; %{amount} > 10000 }"
```
```xml
<!-- Text for amount level using language-dependent texts
from the resource model. -->
text="{= ${/amount} > 10000 ? ${i18n>/high} : ${i18n>/normal} }"
text="{= %{/amount} > 10000 ? %{i18n>/high} : %{i18n>/normal} }"
```
```xml
<!-- Set to visible if the rating is VIP, ignoring case
or if the order amount is greater than 10,000. -->
visible="{= ${/rating}.toUpperCase() === 'VIP' || ${/orderAmount} > 10000 }"
visible="{= %{/rating}.toUpperCase() === 'VIP' || %{/orderAmount} > 10000 }"
```
```xml
<!-- Set to visible if the rating contains VIP, ignoring
the case. -->
visible={= RegExp('vip', 'i').test(${/rating}) }
visible={= RegExp('vip', 'i').test(%{/rating}) }
```
```xml
<!-- Text is maximum of three values. -->
text="{= Math.max(${/value1}, ${/value2}, ${/value3}) }"
text="{= Math.max(%{/value1}, %{/value2}, %{/value3}) }"
```
```xml
<!-- Control is enabled only if the order status is set. -->
enabled="{= ${/orderStatus} !== null }"
enabled="{= %{/orderStatus} !== null }"
```
```xml
Expand All @@ -425,7 +429,7 @@ text="{= 'small@middle@long'.split('@')[1] }"
<!-- Concatenate literal strings and expression bindings
or bindings. -->
text="Hello {=${gender}==='male' ? 'Mr.' : 'Mrs.'} {lastName}"
text="Hello {=%{gender}==='male' ? 'Mr.' : 'Mrs.'} {lastName}"
```
```xml
Expand All @@ -441,9 +445,9 @@ errorMsg=Message is too short
<!-- View -->
<mvc:View controllerName="sample.App" xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc">
...
<Text text="{= ${/data/message}.length &lt; 20
? ${i18n>errorMsg}
: ${parts: [
<Text text="{= %{/data/message}.length &lt; 20
? %{i18n>errorMsg}
: %{parts: [
{path: 'i18n>successMsg'},
{path: '/data/today', type:'sap.ui.model.type.Date', constraints:{displayFormat:'Date'}},
{path: '/data/tomorrow', type:'sap.ui.model.type.Date', constraints:{displayFormat:'Date'}}
Expand Down
Loading

0 comments on commit 7084951

Please sign in to comment.