我有一个智能字段,我定义如下:
<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
or descriptionAndId
.
最后我得到了我想要的:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)