我有一个这样定义的智能字段:
<smartField:SmartField value="{MarktID}" textInEditModeSource="ValueList" >
<smartField:configuration>
<smartField:Configuration preventInitialDataFetchInValueHelpDialog="false" displayBehaviour="idAndDescription"/>
</smartField:configuration>
</smartField:SmartField>
它的呈现方式是这样的(即下拉或选择):
因为我在注释文件中有此定义:
<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
在displayBehaviour
等于idAndDescription
或时显示哪个属性descriptionAndId
。
终于我有了想要的东西: