我正尝试按以下方式使用SmartFilterBar:
视图:
<smartFilterBar:SmartFilterBar id="smartFilterBar" considerSelectionVariants="true" entitySet="ZMD_C_CLASS_OBJECT">
<smartFilterBar:controlConfiguration>
<smartFilterBar:ControlConfiguration key="ClassType" visibleInAdvancedArea="true" preventInitialDataFetchInValueHelpDialog="false"></smartFilterBar:ControlConfiguration>
</smartFilterBar:controlConfiguration>
</smartFilterBar:SmartFilterBar>
视图的控制器:
onInit: function () {
const oModel = this.getModel("ClassSelect");
this.getView().setModel(oModel);
},
dataSources
在清单中定义为:
"dataSources": {
"ZMD_C_CLASS_OBJECT_CDS": {
"uri": "/sap/opu/odata/sap/ZMD_C_CLASS_OBJECT_CDS/",
"type": "OData",
"settings": {
"odataVersion": "2.0",
"localUri": "localService/metadata.xml"
}
}
}
和模型
"ClassSelect": {
"uri": "/sap/opu/odata/sap/ZMD_C_CLASS_OBJECT_CDS/",
"type": "sap.ui.model.odata.v2.ODataModel",
"settings": {
"defaultOperationMode": "Server",
"defaultBindingMode": "OneWay",
"defaultCountMode": "Request"
},
"dataSource": "ZMD_C_CLASS_OBJECT_CDS",
"preload": true
}
OData服务中的元数据:
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:sap="http://www.sap.com/Protocols/SAPData">
<edmx:Reference Uri="https://example.net:80000/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Vocabularies(TechnicalName='%2FIWBEP%2FVOC_COMMON',Version='0001',SAP__Origin='S17CLNT100')/$value" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
<edmx:Include Namespace="com.sap.vocabularies.Common.v1" Alias="Common"/>
</edmx:Reference>
<edmx:DataServices m:DataServiceVersion="2.0">
<Schema Namespace="ZMD_C_CLASS_OBJECT_CDS" xml:lang="de" sap:schema-version="1" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityType Name="ZMD_C_CLASS_OBJECTType" sap:content-version="1">
<Key>
<PropertyRef Name="InternalClass"/>
</Key>
<Property Name="InternalClass" Type="Edm.String" Nullable="false" MaxLength="10" sap:display-format="NonNegative" sap:label="Int.Klasnr" sap:quickinfo="Interne Klassennummer"/>
<Property Name="ClassType" Type="Edm.String" MaxLength="3" sap:display-format="UpperCase" sap:label="Klassenart" sap:value-list="standard"/>
<Property Name="ClassNumber" Type="Edm.String" MaxLength="18" sap:display-format="UpperCase" sap:label="Klasse" sap:quickinfo="Klassennummer"/>
<NavigationProperty Name="to_ClassTypeValueHelp" Relationship="ZMD_C_CLASS_OBJECT_CDS.assoc_6C4786335FC0AB4FBAF59609E841BB3C" FromRole="FromRole_assoc_6C4786335FC0AB4FBAF59609E841BB3C" ToRole="ToRole_assoc_6C4786335FC0AB4FBAF59609E841BB3C"/>
</EntityType>
<EntityType Name="ZMD_I_CLASSTYPE_VHType" sap:content-version="1">
<Key>
<PropertyRef Name="ClassType"/>
<PropertyRef Name="ClassLang"/>
</Key>
<Property Name="ClassType" Type="Edm.String" Nullable="false" MaxLength="3" sap:display-format="UpperCase" sap:label="Klassenart"/>
<Property Name="ClassLang" Type="Edm.String" Nullable="false" MaxLength="2" sap:label="Sprachenschlüssel"/>
<Property Name="ClassText" Type="Edm.String" MaxLength="40" sap:label="Klassenartentext" sap:quickinfo="Bezeichnung der Klassenart"/>
</EntityType>
<Association Name="assoc_6C4786335FC0AB4FBAF59609E841BB3C" sap:content-version="1">
<End Type="ZMD_C_CLASS_OBJECT_CDS.ZMD_C_CLASS_OBJECTType" Multiplicity="1" Role="FromRole_assoc_6C4786335FC0AB4FBAF59609E841BB3C"/>
<End Type="ZMD_C_CLASS_OBJECT_CDS.ZMD_I_CLASSTYPE_VHType" Multiplicity="1" Role="ToRole_assoc_6C4786335FC0AB4FBAF59609E841BB3C"/>
</Association>
<EntityContainer Name="ZMD_C_CLASS_OBJECT_CDS_Entities" m:IsDefaultEntityContainer="true" sap:supported-formats="atom json xlsx">
<EntitySet Name="ZMD_C_CLASS_OBJECT" EntityType="ZMD_C_CLASS_OBJECT_CDS.ZMD_C_CLASS_OBJECTType" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1"/>
<EntitySet Name="ZMD_I_CLASSTYPE_VH" EntityType="ZMD_C_CLASS_OBJECT_CDS.ZMD_I_CLASSTYPE_VHType" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:searchable="true" sap:content-version="1"/>
<AssociationSet Name="assoc_6C4786335FC0AB4FBAF59609E841BB3C" Association="ZMD_C_CLASS_OBJECT_CDS.assoc_6C4786335FC0AB4FBAF59609E841BB3C" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1">
<End EntitySet="ZMD_C_CLASS_OBJECT" Role="FromRole_assoc_6C4786335FC0AB4FBAF59609E841BB3C"/>
<End EntitySet="ZMD_I_CLASSTYPE_VH" Role="ToRole_assoc_6C4786335FC0AB4FBAF59609E841BB3C"/>
</AssociationSet>
</EntityContainer>
<Annotations Target="ZMD_C_CLASS_OBJECT_CDS.ZMD_C_CLASS_OBJECTType/ClassType" xmlns="http://docs.oasis-open.org/odata/ns/edm">
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="Label" String="Value help classification type"/>
<PropertyValue Property="CollectionPath" String="ZMD_I_CLASSTYPE_VH"/>
<PropertyValue Property="SearchSupported" Bool="true"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="ClassType"/>
<PropertyValue Property="ValueListProperty" String="ClassType"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="ClassLang"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="ClassText"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
<atom:link rel="self" href="https://example.net:80000/sap/opu/odata/sap/ZMD_C_CLASS_OBJECT_CDS/$metadata" xmlns:atom="http://www.w3.org/2005/Atom"/>
<atom:link rel="latest-version" href="https://example.net:80000/sap/opu/odata/sap/ZMD_C_CLASS_OBJECT_CDS/$metadata" xmlns:atom="http://www.w3.org/2005/Atom"/>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
编译器抱怨:
我在做什么错了?