呈现为下拉列表的智能字段不显示描述
Smart fields that are rendered as drop down does not show description
我有一个这样定义的智能字段:
<smartField:SmartField value="{MarktID}" textInEditModeSource="ValueList" >
<smartField:configuration>
<smartField:Configuration preventInitialDataFetchInValueHelpDialog="false" displayBehaviour="idAndDescription"/>
</smartField:configuration>
</smartField:SmartField>
它是这样呈现的(即下拉或 select):
因为我的注释文件中有这个定义:
<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>
问题是如何在下拉列表中显示 selected 项的名称。我的意思是我不想显示 1300 (1300)
(如图所示)我想在下拉菜单中显示 1300 (Cimt Handelsgruppe)
。
目前好像不知道括号里要显示什么!?
最终我找到了解决方案!
这是包含有关 drop-down 的数据的实体的定义:
<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"
。通过添加这个小 属性,智能字段知道当 displayBehaviour
等于 idAndDescription
或 descriptionAndId
时,它必须将哪个 属性 显示为 description
。
终于如愿以偿:
我有一个这样定义的智能字段:
<smartField:SmartField value="{MarktID}" textInEditModeSource="ValueList" >
<smartField:configuration>
<smartField:Configuration preventInitialDataFetchInValueHelpDialog="false" displayBehaviour="idAndDescription"/>
</smartField:configuration>
</smartField:SmartField>
它是这样呈现的(即下拉或 select):
因为我的注释文件中有这个定义:
<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>
问题是如何在下拉列表中显示 selected 项的名称。我的意思是我不想显示 1300 (1300)
(如图所示)我想在下拉菜单中显示 1300 (Cimt Handelsgruppe)
。
目前好像不知道括号里要显示什么!?
最终我找到了解决方案!
这是包含有关 drop-down 的数据的实体的定义:
<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"
。通过添加这个小 属性,智能字段知道当 displayBehaviour
等于 idAndDescription
或 descriptionAndId
时,它必须将哪个 属性 显示为 description
。
终于如愿以偿: