Skip to content

Commit 65592d8

Browse files
committed
add value help as tree table
1 parent 177d7e1 commit 65592d8

File tree

6 files changed

+44
-5
lines changed

6 files changed

+44
-5
lines changed

app/admin/fiori-service.cds

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,33 @@ annotate AdminService.Books with @(UI : {
5454
]}
5555
});
5656

57+
// Add Value Help for Tree Table
58+
annotate AdminService.Books with {
59+
genre @(Common: {
60+
Label : 'Genre',
61+
ValueList: {
62+
CollectionPath : 'GenreHierarchy',
63+
Parameters : [
64+
{
65+
$Type : 'Common.ValueListParameterDisplayOnly',
66+
ValueListProperty: 'name',
67+
}],
68+
PresentationVariantQualifier: 'VH',
69+
}
70+
});
71+
}
72+
73+
annotate AdminService.GenreHierarchy with @UI: {
74+
PresentationVariant #VH: {
75+
$Type : 'UI.PresentationVariantType',
76+
Visualizations : ['@UI.LineItem'],
77+
RecursiveHierarchyQualifier: 'AdminHierarchy'
78+
},
79+
LineItem : [{
80+
$Type: 'UI.DataField',
81+
Value: name,
82+
}]
83+
};
5784

5885
////////////////////////////////////////////////////////////
5986
//

app/common.cds

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,9 @@ annotate my.Genres with
177177
UI : {
178178
SelectionFields : [name],
179179
LineItem : [
180-
{Value : name}
180+
{Value : name,
181+
Label : '{i18n>Name}',
182+
},
181183
],
182184
}
183185
);

db/books.cds

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ namespace my.bookshop;
22

33
using {
44
Currency,
5-
sap,
65
managed,
76
cuid
87
} from '@sap/cds/common';
@@ -46,9 +45,11 @@ annotate Authors with
4645
/**
4746
* Hierarchically organized Code List for Genres
4847
*/
49-
entity Genres : sap.common.CodeList {
48+
entity Genres {
5049
key ID : Integer;
5150
node : Integer not null;
5251
parent_node : Integer default 0;
52+
name : localized String(255);
53+
descr : localized String(1000);
5354
parent : Association to one Genres on parent.node = parent_node;
5455
}

srv/cat-service.cds

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ service CatalogService @(requires: 'any') {
1313
@readonly
1414
entity Authors as projection on my.Authors;
1515

16+
@readonly
17+
entity Genres as projection on my.Genres;
18+
1619
@readonly
1720
entity Reviews as projection on my.Reviews;
1821

srv/genres.cds

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ aspect Hierarchy {
66
virtual DrillState : String;
77
virtual Matched : Boolean;
88
virtual MatchedDescendantCount : Integer64;
9+
virtual LimitedRank : Integer64;
910
}
1011

1112

@@ -14,13 +15,15 @@ annotate Hierarchy with @Capabilities.FilterRestrictions.NonFilterableProperties
1415
'DistanceFromRoot',
1516
'DrillState',
1617
'Matched',
17-
'MatchedDescendantCount'
18+
'MatchedDescendantCount',
19+
'LimitedRank'
1820
];
1921

2022
annotate Hierarchy with @Capabilities.SortRestrictions.NonSortableProperties: [
2123
'LimitedDescendantCount',
2224
'DistanceFromRoot',
2325
'DrillState',
2426
'Matched',
25-
'MatchedDescendantCount'
27+
'MatchedDescendantCount',
28+
'LimitedRank'
2629
];

srv/review-service.cds

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ service ReviewService {
1313
@readonly
1414
entity Authors as projection on my.Authors;
1515

16+
@readonly
17+
entity Genres as projection on my.Genres;
18+
1619
// access control restrictions
1720
annotate Reviews with @restrict : [
1821
{

0 commit comments

Comments
 (0)