Sapui5 SmartTable中没有数据

Sapui5 SmartTable中没有数据,sapui5,Sapui5,我正在尝试使用智能表调用OData服务。首先,我创建了一个简单的表,通过它我可以看到表中的数据。然后我在同一页上添加了SmartTable,但它没有显示任何数据。甚至没有创建任何列。原因可能是什么 <mvc:View controllerName="com.siemens.hc.controller.View1" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" x

我正在尝试使用智能表调用OData服务。首先,我创建了一个简单的表,通过它我可以看到表中的数据。然后我在同一页上添加了SmartTable,但它没有显示任何数据。甚至没有创建任何列。原因可能是什么

<mvc:View controllerName="com.siemens.hc.controller.View1" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc"
    xmlns="sap.m" xmlns:smartField="sap.ui.comp.smartfield" xmlns:smartFilterBar="sap.ui.comp.smartfilterbar"
    xmlns:smartTable="sap.ui.comp.smarttable">
    <App>
        <pages>
            <Page title="{i18n>title}">
                <content>                   
                        <Table id="idProductsTable" inset="false" items="{/SafetyUpdateSet}">
                            <headerToolbar>
                                <Toolbar>
                                    <Title text="Product" level="H2"/>
                                </Toolbar>
                            </headerToolbar>
                            <columns>
                                <Column width="12em">
                                    <Text text="Product"/>
                                </Column>
                            </columns>
                            <items>
                                <ColumnListItem>
                                    <cells>
                                        <ObjectIdentifier title="{Notification}"/>
                                    </cells>
                                </ColumnListItem>
                            </items>
                        </Table>

                    <smartTable:SmartTable id="smartTable_ResponsiveTable" tableType="ResponsiveTable" editable="false" entitySet="SafetyUpdateSet"
                        useVariantManagement="false" useTablePersonalisation="false" header="Notification" showRowCount="true" useExportToExcel="false"
                        enableAutoBinding="true">                           
                    </smartTable:SmartTable>
                </content>
            </Page>
        </pages>
    </App>
</mvc:View>

我已经在neo-app.json文件中创建了目的地,并在Manifest.json文件中创建了模型

问候,,
Mayank

您有一个名为“发票”的型号。根据说明,智能控件不支持命名的模型。

我必须在SmartTable中手动定义列

<smartTable:SmartTable id="smartTable_ResponsiveTable" tableType="ResponsiveTable" editable="false" entitySet="EntitySet"
                    useVariantManagement="false" useTablePersonalisation="false" header="Notification" showRowCount="true" useExportToExcel="false"
                    enableAutoBinding="true" initiallyVisibleFields="Col1,Col2,Col3,Col4,Col5"></smartTable:SmartTable>

如果oData服务支持注释,您也可以使用注释文件。创建新注释文件,注释图元集,并添加LineItem/DataField注释。这将显示您选择的字段

            <Annotations Target="<oData.Service>">
            <Annotation Term="UI.LineItem">
                <Collection>
                    <Record Type="UI.DataField">
                        <PropertyValue Property="Value" Path="Field1"/>
                        <PropertyValue Property="Label" String="{i18n>Field1Label}"/>
                    </Record>
                    <Record Type="UI.DataField">
                        <PropertyValue Property="Value" Path="Field2"/>
                        <PropertyValue Property="Label" String="{i18n>Field2Label}"/>
                    </Record>
                    <Record Type="UI.DataField">
                        <PropertyValue Property="Value" Path="Field3"/>
                        <PropertyValue Property="Label" String="{i18n>Field3Label}"/>
                    </Record>
                </Collection>
            </Annotation>
        </Annotations>


如果您喜欢oData字段名,可以省略“label”属性。

我刚刚遇到了这个错误

这可以通过添加

xmlns:app="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1"

在视野的顶端。虽然我找不到添加此项的任何原因/解释,但我相信这与FlexItemData有关。

您好,Matbtt,是的,我已经删除了此项。贴完帖子后我看到了。但它仍然不起作用。@Mayank:日志中有错误吗?在您发现命名模型不起作用后,更新问题将非常有用。嗨,Mat,谢谢您的回复。日志中没有错误。当我检查lineItem是否没有注释标记时,我想在Odata服务中再添加一件事。您认为这是强制性的吗?您是否为智能表提供了必要的元数据?智能表需要行项元数据。您好,Schmitt,不,我们没有为Odata定义行项元数据。因此,我必须手动创建默认列,并且它工作正常。