我试图使用以下代码将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>
答案 0 :(得分:0)
我假设您在先前的测试中使用了自定义模型“ TEST”。
如果在没有命名模型的情况下通过清单获得oData服务数据,请将tableBindingPath更改为: tableBindingPath =“ / trainingPlan”