使用公开的Nortwhind oData v2服务,我可以使用以下代码在正常的sap.m.Table中扩展Product and Supplier实体:
<Table
id="table"
width="auto"
class="sapUiResponsiveMargin"
items="{
path: '/Products',
parameters : { expand: 'Supplier' }
}">
<columns>
<Column id="nameColumn">
<Text
text="{i18n>tableNameColumnTitle}"
id="nameColumnTitle" />
</Column>
<Column hAlign="End">
<Text text="test" />
</Column>
</columns>
<items>
<ColumnListItem
type="Navigation"
press="onPress">
<cells>
<ObjectIdentifier title="{ProductName}"/>
<Text text="{Supplier/CompanyName}"/>
</cells>
</ColumnListItem>
</items>
</Table>
现在如何使用智能表实现相同的输出?基于此post我尝试了以下内容:
<sap.ui.comp.smarttable:SmartTable
xmlns:sap.ui.comp.smarttable="sap.ui.comp.smarttable"
tableType="ResponsiveTable"
header="Smart Table"
enableAutoBinding="true"
entitySet="Products"
initiallyVisibleFields="ProductName"
tableBindingPath="Supplier"/>
但它没有用 . 有什么建议?
2 回答
那就是如何在Smarttables上使用$ expand
仅通过NavigationProperty . 你需要像下面提到的那样扩展你的smarttable列:
我更进了一步 . 我添加了以下代码:
在beforeRebindTable事件中启动 . 它触发后端中的get扩展实体集 . 问题是我仍然只能看到第一个实体中的列,因为它在entitySet参数中指定 . 有没有办法显示其他实体的列?