2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

CAP & Fiori Elements: List Reportの一覧にアイコンと色設定

Posted at

検索結果一覧項目にCriticalityとしてアイコン表示と色変更をします。
FioriでUI作成はほとんどやったことなかったので、調べた内容をメモすべく記事書きます。

この「Status with Help」項目
image.png

前提

以下で設定したローカル環境および実装した内容が前提です。

手順

UIアノテーション変更

今回はUIアノテーション変更のみです。ファイルsrv/cat-service-ui.cdsを変更します。
一番下のLineItem以下が対象です。
コメントアウトしたCriticalityRepresentation: #WithoutIcon,を有効にするとアイコンが非表示です。

srv/cat-service-ui.cds
annotate CatalogService.Books with {
    ID             @title: 'ID';
    title          @title: 'Title';
    stock          @title: 'Stock';
    statusHelp     @(
        title : 'Status with Help',
        Common: {ValueList: {
            CollectionPath: 'Statuses',
            Parameters    : [
                {
                    $Type            : 'Common.ValueListParameterInOut',
                    LocalDataProperty: statusHelp_ID,
                    ValueListProperty: 'ID'
                },
                {
                    $Type            : 'Common.ValueListParameterDisplayOnly',
                    ValueListProperty: 'text'
                },
            ]
        }}
    );
    statusDropDown @(
        title                          : 'Status with Dropdown',
        Common.ValueListWithFixedValues: true,
    );
}

annotate CatalogService.Books with @(UI: {
    SelectionFields: [
        ID,
        title,
        stock,
        statusHelp_ID,
        statusDropDown_ID,
    ],
    LineItem       : [
        {Value: ID},
        {Value: title},
        {Value: stock},
        {
            Value                    : statusHelp_ID,
            Criticality              : statusHelp_ID,
//            CriticalityRepresentation: #WithoutIcon,
        }
    ]
});

おまけ

Initial Load

テストしていると画面表示時に検索済にしたいことも多いです。
Fiori ToolsのApplication Information画面からListReportを開き、Tableに対してInitial Load を「Enabled」に設定することで検索済みにできます。
※雑ですいません。
image.png

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?