Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion resources/guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@
```
- Find more information on the UI5 documentation page "Declarative API for Initial Components"
- **ALWAYS** use data binding in views to connect UI controls to data or i18n models.
- When binding data from OData services, **NEVER** use custom formatters for standard data types (e.g., dates, numbers, currencies). The built-in types handle these cases automatically.
- **ALWAYS** prefer built-in data types with format options for formatting in data binding:
- To handle standard formatting needs, use **built-in data types with format options**, for example `sap.ui.model.type.Integer` or `sap.ui.model.type.Currency` with a `formatOptions` object. For OData models, use the types provided in the `sap.ui.model.odata.type` namespace, for example `sap.ui.model.odata.type.Decimal`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The OData types can also be used w/o ODataModels. Would we not enforce the usage of the OData types? I.e. recommend sap.ui.model.odata.type.Currency and sap.ui.model.odata.type.Int64. Non-OData types should only be used if there is no matching OData type, e.g. for DateInterval.
Background: OData types work also w/o OData. And the data often enough comes from an OData-service even if a JSONModel is used (at least in the SAP context).

Example: For number formatting with a thousands separator, use `sap.ui.model.type.Integer` with `formatOptions: {groupingEnabled: true}`.
- Only write **custom formatter functions** for unique business logic that cannot be handled by the built-in data types and their format options. This applies to **ALL** data sources, including OData models, JSON models, and others. Our built-in data types can handle standard data types, such as dates, numbers, and currencies. You should always prefer them over custom solutions.
- When making changes to `*.properties` files, **ALWAYS** apply the changes to all relevant locales. This ensures consistency across different language versions of the application.
- **Example:** If you add a new key to `i18n.properties`, also add it to existing translation files like e.g `i18n_en.properties`, `i18n_de.properties`, etc.
- **NEVER** use inline script in HTML
Expand Down