我试图使用以下代码将oData表连接到我的web ide中的智能表。我已经看到了我的oData的元数据和我想要访问的实体集是trainingPlan。 PLANID和COURSEID是我正在访问的表中的2列。在结果屏幕中,只有空工具栏即将到来,并且在其下方写入“无数据”。当我尝试使用普通表显示并显示数据时,可以访问该表。
#App.view.xml
<core:View xmlns:core="sap.ui.core" xmlns="sap.m" xmlns:smartFilterBar="sap.ui.comp.smartfilterbar"
xmlns:smartTable="sap.ui.comp.smarttable" xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:app="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1" controllerName="Workspace.controller.App" height="100%">
<smartFilterBar:SmartFilterBar id="smartFilterBar" entitySet="trainingPlan" persistencyKey="SmartFilter_Explored" enableBasicSearch="true" >
<smartFilterBar:controlConfiguration>
<smartFilterBar:ControlConfiguration key="PLANID"></smartFilterBar:ControlConfiguration>
<smartFilterBar:ControlConfiguration key="COURSEID"></smartFilterBar:ControlConfiguration>
</smartFilterBar:controlConfiguration>
</smartFilterBar:SmartFilterBar>
<smartTable:SmartTable entitySet="trainingPlan" initiallyVisibleFields="PLANID" smartFilterId="smartFilterBar" tableType="ResponsiveTable" useExportToExcel="true"
useVariantManagement="false" useTablePersonalisation="true" header="Line Items" showRowCount="true" tableBindingPath="{TEST>/trainingPlan}"
persistencyKey="SmartTableAnalytical_Explored" enableAutoBinding="true" demandPopin="true" class="sapUiResponsiveContentPadding"
/>
</core:View>
#metadata.xml
<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"
Version="1.0">
<edmx:DataServices
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
m:DataServiceVersion="2.0">
<Schema xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns="http://schemas.microsoft.com/ado/2008/09/edm"
Namespace="demo.services.demo">
<<EntityType Name="trainingPlanType">
<Key>
<PropertyRef Name="PLANID"/>
<PropertyRef Name="COURSEID"/>
</Key>
<Property Name="PLANID" Type="Edm.Int32" Nullable="false"/>
<Property Name="COURSEID" Type="Edm.Int32" Nullable="false"/>
<Property Name="COURSENAME" Type="Edm.String" Nullable="false"
MaxLength="255"/>
<Property Name="STARTDATE" Type="Edm.DateTime" Nullable="false"/>
<Property Name="AVAILSEAT" Type="Edm.Int32" Nullable="false"/>
<Property Name="TOTALSEATS" Type="Edm.Int32" Nullable="false"/>
<Property Name="ROOMNO" Type="Edm.Int32" Nullable="false"/>
<Property Name="COURSEDURATION" Type="Edm.String" MaxLength="255"/>
</EntityType>
<EntityContainer Name="demo" m:IsDefaultEntityContainer="true">
<EntitySet Name="trainingPlan"
EntityType="demo.services.demo.trainingPlanType"/>
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
我假设您在之前的测试中使用了自定义模型“TEST”。
如果通过清单获取oData服务数据而没有命名模型,则将tableBindingPath更改为:tableBindingPath =“/ trainingPlan”