Skip to content

Commit 68f9cdd

Browse files
authored
Add a nav prop to table settings only (#59)
1 parent c347383 commit 68f9cdd

4 files changed

Lines changed: 53 additions & 1 deletion

File tree

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ Open `http://localhost:4008/$launchpad` in the Browser to get to the SAP Fiori l
7979
- [Adding Currency or UoM Fields to a table](#adding-currency-or-uom-fields-to-a-table)
8080
- [Customize Currency or UoM scale](#customize-currency-or-uom-scale)
8181
- [Adding a link to a table](#adding-a-link-to-a-table)
82+
- [Adding a navigation property only to personalization](#adding-a-navigation-property-only-to-personalization)
8283
- [Add custom column (Extensibility)](#add-custom-column-extensibility)
8384
- [Object Page](#object-page)
8485
- [General Features](#general-features-object-page)
@@ -2132,6 +2133,49 @@ annotate srv.RootEntities with {
21322133

21332134
The annotation is documented [here](https://sap.github.io/odata-vocabularies/vocabularies/HTML5.html#LinkTarget).
21342135

2136+
#### Adding a navigation property only to personalization
2137+
2138+
<i>Search term:</i> [`#NavPropInAdaptability`](../../search?q=NavPropInAdaptability), [`DataField::association2one`](../../search?q=DataField::association2one::country_code)
2139+
2140+
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.
2141+
2142+
```cds
2143+
@UI.LineItem : [
2144+
{
2145+
//Search-Term: #NavPropInAdaptability
2146+
Label : 'Navigation field only available via settings',
2147+
Value : association2one.country_code,
2148+
}
2149+
]
2150+
```
2151+
2152+
Setting the `availability` property to `Adaptation`, will only bring up the property in the table settings for the user add it if necessary.
2153+
2154+
```json
2155+
"RootEntityListReport": {
2156+
...
2157+
"options": {
2158+
"settings": {
2159+
...
2160+
"controlConfiguration": {
2161+
"@com.sap.vocabularies.UI.v1.LineItem": {
2162+
...
2163+
"columns": {
2164+
"DataField::association2one::country_code": {
2165+
"availability": "Adaptation"
2166+
}
2167+
}
2168+
},
2169+
...
2170+
},
2171+
...
2172+
}
2173+
}
2174+
}
2175+
```
2176+
2177+
The ID of the column follows the pattern `DataField::<path>`, with the dots in the navigation path being replaced by two ':', e.g. `DataField::association2one::country_code`.
2178+
21352179
#### Add custom column (Extensibility)
21362180

21372181
<i>Search term:</i> [`#CustomColumn`](../../search?q=CustomColumn)

app/listreport-objectpage/layouts_RootEntities.cds

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ annotate srv.RootEntities with @(
6464
Value : fieldWithUoM,
6565
@UI.Importance: #Low,
6666
},
67+
{
68+
//Search-Term: #NavPropInAdaptability
69+
Label : 'Navigation field only available via settings',
70+
Value : association2one.country_code,
71+
},
6772
{
6873
$Type : 'UI.DataField',
6974
Value : fieldWithCriticality,

app/listreport-objectpage/webapp/manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@
191191
"placement": "After",
192192
"anchor": "DataField::fieldWithCriticality"
193193
}
194+
},
195+
"DataField::association2one::country_code": {
196+
"availability": "Adaptation"
194197
}
195198
}
196199
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
],
5656
"cds": {
5757
"launchpad": {
58-
"version": "1.141.0"
58+
"version": "1.145.0"
5959
},
6060
"requires": {
6161
"[production]": {

0 commit comments

Comments
 (0)