当我试图过滤一些东西(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.1XML
<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>发布于 2017-07-05 22:25:22
问题在于注释,它们应该是这样的:
<Record Type="com.sap.vocabularies.UI.v1.DataField">
<PropertyValue Property="Label" String="DateCreated"/>
<PropertyValue Property="Value" Path="Erdat"/>
</Record>发布于 2017-06-22 22:59:26
请将以下代码片段复制到您的控制器中,并将该方法添加到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);
}
},https://stackoverflow.com/questions/44701490
复制相似问题