Odata SAPUI5智能表扩展

Odata SAPUI5智能表扩展,odata,sapui5,sap-fiori,Odata,Sapui5,Sap Fiori,使用公开提供的Nortwhind oData v2服务,我可以使用以下代码在普通sap.m.表中扩展产品和供应商实体: <Table id="table" width="auto" class="sapUiResponsiveMargin" items="{ path: '/Products', parameters : { expand: 'Supplier' } }"> <colu

使用公开提供的Nortwhind oData v2服务,我可以使用以下代码在普通sap.m.表中扩展产品和供应商实体:

<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>
    onBeforeRebind: function(oEvent) {
var mBindingParams = oEvent.getParameter("bindingParams");
    mBindingParams.parameters["expand"] = "Supplier";
},
onBeforeRebind: function(oEvent) { var mBindingParams = oEvent.getParameter("bindingParams");
mBindingParams.parameters["expand"] = "Supplier"; },

现在,如何使用智能表实现相同的输出?基于此,我尝试了以下方法:

<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"/>


但它不起作用。有什么建议吗?

我更进一步了。我添加了以下代码:

<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>
    onBeforeRebind: function(oEvent) {
var mBindingParams = oEvent.getParameter("bindingParams");
    mBindingParams.parameters["expand"] = "Supplier";
},
onBeforeRebind: function(oEvent) { var mBindingParams = oEvent.getParameter("bindingParams");
mBindingParams.parameters["expand"] = "Supplier"; },

在可重新绑定事件之前启动。它触发后端中的get expanded实体集。问题是,我仍然只能看到entitySet参数中指定的第一个实体中的列。有没有办法显示其他实体中的列

我又前进了一步。我添加了以下代码:

<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>
    onBeforeRebind: function(oEvent) {
var mBindingParams = oEvent.getParameter("bindingParams");
    mBindingParams.parameters["expand"] = "Supplier";
},
onBeforeRebind: function(oEvent) { var mBindingParams = oEvent.getParameter("bindingParams");
mBindingParams.parameters["expand"] = "Supplier"; },
在可重新绑定事件之前启动。它触发后端中的get expanded实体集。问题是,我仍然只能看到entitySet参数中指定的第一个实体中的列。有没有办法显示其他实体中的列


我又向前迈进了一步。我添加了以下代码:

<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>
    onBeforeRebind: function(oEvent) {
var mBindingParams = oEvent.getParameter("bindingParams");
    mBindingParams.parameters["expand"] = "Supplier";
},
onBeforeRebind: function(oEvent) { var mBindingParams = oEvent.getParameter("bindingParams");
mBindingParams.parameters["expand"] = "Supplier"; },
这就是如何在Smarttables上使用$expand

有没有办法显示其他实体中的列

仅通过NavigationProperty。您需要像下面提到的那样扩展smarttable列:

<smartTable:SmartTable 
        entitySet="Products"
        tableType="ResponsiveTable"
        header="Products" showRowCount="true"
        enableAutoBinding="true"
        class="sapUiResponsiveContentPadding">
        <Table>
            <columns>
                <Column width="100px" hAlign="Left">
                    <customData>
                        <core:CustomData key="p13nData"
                            value='\{"columnKey": "p13nDataKey",  "columnIndex":"4", "leadingProperty": "Supplier"}' />
                    </customData>
                    <Text text="{/#Supplier/Name/@sap:label}" />
                </Column>
            </columns>
            <items>
                <ColumnListItem>
                    <cells>
                        <Text
                            text="{Supplier/Name}" />
                    </cells>
                </ColumnListItem>
            </items>
        </Table>
    </smartTable:SmartTable>


我又向前迈进了一步。我添加了以下代码:

<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>
    onBeforeRebind: function(oEvent) {
var mBindingParams = oEvent.getParameter("bindingParams");
    mBindingParams.parameters["expand"] = "Supplier";
},
onBeforeRebind: function(oEvent) { var mBindingParams = oEvent.getParameter("bindingParams");
mBindingParams.parameters["expand"] = "Supplier"; },
这就是如何在Smarttables上使用$expand

有没有办法显示其他实体中的列

仅通过NavigationProperty。您需要像下面提到的那样扩展smarttable列:

<smartTable:SmartTable 
        entitySet="Products"
        tableType="ResponsiveTable"
        header="Products" showRowCount="true"
        enableAutoBinding="true"
        class="sapUiResponsiveContentPadding">
        <Table>
            <columns>
                <Column width="100px" hAlign="Left">
                    <customData>
                        <core:CustomData key="p13nData"
                            value='\{"columnKey": "p13nDataKey",  "columnIndex":"4", "leadingProperty": "Supplier"}' />
                    </customData>
                    <Text text="{/#Supplier/Name/@sap:label}" />
                </Column>
            </columns>
            <items>
                <ColumnListItem>
                    <cells>
                        <Text
                            text="{Supplier/Name}" />
                    </cells>
                </ColumnListItem>
            </items>
        </Table>
    </smartTable:SmartTable>


Hi Haos,您知道如何筛选/分拣或分组列供应商/名称吗?我可以过滤产品表的其他列,除非供应商表的列(我指的是集合表)。谢谢…DieuHi Haos,你知道如何过滤/分类或分组列供应商/名称吗?我可以过滤产品表的其他列,除非是供应商表的列(我是指集合表)。谢谢…Dieu