diff --git a/README.md b/README.md index 9c1e351..79c80ec 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,7 @@ Open `http://localhost:4008/$launchpad` in the Browser to get to the SAP Fiori l - [Adding Currency or UoM Fields to a table](#adding-currency-or-uom-fields-to-a-table) - [Customize Currency or UoM scale](#customize-currency-or-uom-scale) - [Adding a link to a table](#adding-a-link-to-a-table) + - [Adding a navigation property only to personalization](#adding-a-navigation-property-only-to-personalization) - [Add custom column (Extensibility)](#add-custom-column-extensibility) - [Object Page](#object-page) - [General Features](#general-features-object-page) @@ -2132,6 +2133,49 @@ annotate srv.RootEntities with { The annotation is documented [here](https://sap.github.io/odata-vocabularies/vocabularies/HTML5.html#LinkTarget). +#### Adding a navigation property only to personalization + +Search term: [`#NavPropInAdaptability`](../../search?q=NavPropInAdaptability), [`DataField::association2one`](../../search?q=DataField::association2one::country_code) + +Associations and compositions can be added as columns to a table by adding them to the `@UI.LineItem` annotation. If the property should only be available via the personalization settings, an additional configuration in the [manifest.json](app/listreport-objectpage/webapp/manifest.json) is necessary. + +```cds +@UI.LineItem : [ + { + //Search-Term: #NavPropInAdaptability + Label : 'Navigation field only available via settings', + Value : association2one.country_code, + } +] +``` + +Setting the `availability` property to `Adaptation`, will only bring up the property in the table settings for the user add it if necessary. + +```json +"RootEntityListReport": { + ... + "options": { + "settings": { + ... + "controlConfiguration": { + "@com.sap.vocabularies.UI.v1.LineItem": { + ... + "columns": { + "DataField::association2one::country_code": { + "availability": "Adaptation" + } + } + }, + ... + }, + ... + } + } +} +``` + +The ID of the column follows the pattern `DataField::`, with the dots in the navigation path being replaced by two ':', e.g. `DataField::association2one::country_code`. + #### Add custom column (Extensibility) Search term: [`#CustomColumn`](../../search?q=CustomColumn) diff --git a/app/listreport-objectpage/layouts_RootEntities.cds b/app/listreport-objectpage/layouts_RootEntities.cds index f002cfb..52cc2a6 100644 --- a/app/listreport-objectpage/layouts_RootEntities.cds +++ b/app/listreport-objectpage/layouts_RootEntities.cds @@ -64,6 +64,11 @@ annotate srv.RootEntities with @( Value : fieldWithUoM, @UI.Importance: #Low, }, + { + //Search-Term: #NavPropInAdaptability + Label : 'Navigation field only available via settings', + Value : association2one.country_code, + }, { $Type : 'UI.DataField', Value : fieldWithCriticality, diff --git a/app/listreport-objectpage/webapp/manifest.json b/app/listreport-objectpage/webapp/manifest.json index 47c4f0d..63d6106 100644 --- a/app/listreport-objectpage/webapp/manifest.json +++ b/app/listreport-objectpage/webapp/manifest.json @@ -191,6 +191,9 @@ "placement": "After", "anchor": "DataField::fieldWithCriticality" } + }, + "DataField::association2one::country_code": { + "availability": "Adaptation" } } }, diff --git a/package.json b/package.json index d7c1084..09f8706 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ ], "cds": { "launchpad": { - "version": "1.141.0" + "version": "1.145.0" }, "requires": { "[production]": {