具有多个关联的 UI5 对象属性



我已经成功地创建了一个要在UI5中显示的对象列表,并将该列表连接到OData服务:

<content>
<List id="__list" items="{SalesList}">
<items>
<ObjectListItem title="{SalesTitle}">
<attributes>
<ObjectAttribute title="Id" text="{Id}"/>
<ObjectAttribute title="Sales Code" text="{Cd}"/>
</attributes>
</ObjectListItem>
</items>
</List>
</content>

但是,我想向 ObjectListItem 添加另一个名为"Discription"的属性,该属性是从其他数据源(不是 SalesList)中提取的。在$metadata中,我有一个关联,它将销售 ID 链接到名为 SalesScription 的销售描述。

我试图找到在 ObjectListItem 中显示销售描述的方法,但没有任何成功:

<content>
<List id="__list" items="{SalesList}">
<items>
<ObjectListItem title="{SalesTitle}">
<attributes>
<ObjectAttribute title="Id" text="{Id}"/>
<ObjectAttribute title="Sales Code" text="{Cd}"/>
<ObjectAttribute title="Discription" text="{Desc}" attributes="{SalesDescription}"/>
</attributes>
</ObjectListItem>
</items>
</List>
</content>

删除 Id 和销售代码属性,并将关联调用移动到 ObjectListItem 确实可以正确显示销售标题和说明的列表,但我还需要将 ID 和销售代码包含在属性中:

<content>
<List id="__list" items="{SalesList}">
<items>
<ObjectListItem title="{SalesTitle}" attributes="{SalesDescription}">
<attributes>
<ObjectAttribute title="Discription" text="{Desc}"/>
</attributes>
</ObjectListItem>
</items>
</List>
</content>

有谁知道包含来自两个不同$metadata关联的对象属性的方法? 或者至少是一种在 ObjectListItem 中显示来自两个不同来源的数据的方法(不一定是属性)?

你能试试这个吗?我正在使用"绑定"属性设置绑定上下文。我假设销售列表与销售描述是 1:1 关系。(协会)。此外,"销售说明"是导航属性的名称。

<content>
<List id="__list" items="{SalesList}">
<items>
<ObjectListItem title="{SalesTitle}">
<attributes>
<ObjectAttribute title="Id" text="{Id}"/>
<ObjectAttribute title="Sales Code" text="{Cd}"/>
<ObjectAttribute title="Discription" text="{Desc}" binding="{SalesDescription}"/>
</attributes>
</ObjectListItem>
</items>
</List>
</content>