当我尝试过滤某些内容(smartFilter)时,我收到404错误,检查我的有效负载,我发现其中没有实体:
GET null/$count?$filter=startswith(undefined,22) HTTP/1.1
这个正在运作
GET RfcSearchRequisitionsSet?$skip=0&$top=100&$filter=(Banfn%20eq%20%2722%27)&$select=Bsart%2cBanfn%2cBnfpo%2cWerks HTTP/1.1
XML
<smartFilterBar:SmartFilterBar id="smartFilterBar"
entityType="RfcSearchRequisitions">
<smartFilterBar:controlConfiguration>
<smartFilterBar:ControlConfiguration
key="Banfn" index="1" groupId="_BASIC" width="300px"
visibleInAdvancedArea="true">
</smartFilterBar:ControlConfiguration>
</smartFilterBar:controlConfiguration>
</smartFilterBar:SmartFilterBar>
<smartTable:SmartTable id="smartTable"
entitySet="RfcSearchRequisitionsSet" smartFilterId="smartFilterBar"...>
注解
<Annotation Term="com.sap.vocabularies.UI.v1.LineItem">
<Collection>
<Record Type="com.sap.vocabularies.UI.v1.DataFieldForAnnotation">
<PropertyValue Property="Label" String="DocType"/>
<PropertyValue Property="Target" AnnotationPath="BSART"/>
</Record>
答案 0 :(得分:1)
请将以下代码段复制到您的控制器中,并将该方法添加到SmartTable XML中的事件“beforeRebindTable”中。喜欢:beforeRebindTable =“handleBeforeRebindTable”
handleBeforeRebindTable: function(oEvent) {
var mBindingParams = oEvent.getParameter("bindingParams"),
aCustomFilters = [],
sFilterValue = 22; // it's an example, use your filter value
// Getting filter parameters value
if (sFilterValue ) {
aCustomFilters.push(new sap.ui.model.Filter("Banfn", sap.ui.model.FilterOperator.StartsWith, sFilterValue ));
}
var oOwnMultiFilter = new sap.ui.model.Filter(aCustomFilters, true);
if (mBindingParams.filters[0] && mBindingParams.filters[0].aFilters) {
var oSmartTableMultiFilter = mBindingParams.filters[0];
// if an internal multi-filter exists of your smart table then combine custom multi-filters and internal multi-filters with an AND
mBindingParams.filters[0] = new sap.ui.model.Filter([oSmartTableMultiFilter, oOwnMultiFilter], true);
} else {
mBindingParams.filters.push(oOwnMultiFilter);
}
},
答案 1 :(得分:-1)
问题在于注释,它们应该是:
<Record Type="com.sap.vocabularies.UI.v1.DataField">
<PropertyValue Property="Label" String="DateCreated"/>
<PropertyValue Property="Value" Path="Erdat"/>
</Record>