呈现为下拉列表的智能字段不显示描述

问题描述

我有一个这样定义的智能字段:

<smartField:SmartField value="{MarktID}" textInEditModeSource="ValueList" >
    <smartField:configuration>
        <smartField:Configuration preventInitialDataFetchInValueHelpDialog="false" displayBehaviour="idAndDescription"/>
    </smartField:configuration>
</smartField:SmartField>

它是这样呈现的(即下拉或选择):

enter image description here

因为我的注释文件中有以下定义:

<Annotations Target="Metadata.Meldungen/MarktID">
    <Annotation Term="Common.ValueListWithFixedValues" Bool="true"/>
    <Annotation Term="Common.ValueList">
        <Record>
            <PropertyValue Property="CollectionPath" String="MarktSet"/>
            <PropertyValue Property="Parameters">
                <Collection>
                    <Record Type="Common.ValueListParameterOut">
                        <PropertyValue Property="LocalDataProperty" PropertyPath="MarktID"/>
                        <PropertyValue Property="ValueListProperty" String="ID"/>
                    </Record>
                    <Record Type="Common.ValueListParameterDisplayOnly">
                        <PropertyValue Property="ValueListProperty" String="Name"/>
                    </Record>
                </Collection>
            </PropertyValue>
        </Record>
    </Annotation>
</Annotations>

问题是如何在下拉菜单中显示所选项目的名称。我的意思是我不想在下拉菜单中显示1300 (1300)(如图所示),而不是显示1300 (Cimt Handelsgruppe)

目前似乎不知道括号中要显示什么!?

解决方法

最终我找到了解决方法!

以下是实体的定义,其中包含有关下拉列表的数据:

<EntityType Name="Markt" sap:content-version="1">
    <Key>
        <PropertyRef Name="ID"/>
    </Key>
    <Property Name="ID" Type="Edm.String" Nullable="false" MaxLength="4" sap:display-format="UpperCase" sap:label="ID" sap:text="Name"/>
    <Property Name="Name" Type="Edm.String" Nullable="false" sap:label="Name"/>
</EntityType>

我的定义中缺少的是sap:text="Name"。通过添加此小属性,智能字段知道当description等于displayBehaviouridAndDescription时,智能字段必须将哪个属性显示为descriptionAndId

最后,我有了想要的东西:

enter image description here

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...