我有使用Fiori元素的fiori应用程序,我想调整UI5在$batch调用中为odata生成的OData查询。
我已经将livemode转到列表报告,smartfilter用于选择/筛选,并使用list of values注释。但是问题是,当我在选择字段中输入筛选值时(比如出售给),$batch调用触发OData的下面的查询。
../invoice_list.xsodata/vlsoldto?sap-client=100&$skip=0&$top=10&$filter=startswith(SOLDTO___T,%27TEST%27)我想调整odata调用,使其使用'substringof‘而不是’startswith‘。如下所示。
../invoice_list.xsodata/vlsoldto?sap-client=100&$skip=0&$top=10&$filter=substringof(%27TEST%27,CRM_SOLDTO___T)我不知道在哪里我可以进行这种定制。我知道如何做Fiori元素扩展,但是如果它是一个扩展,那么是什么类型的扩展,什么事件,或者任何其他方法,如果不是扩展的话,我会寻找一些信息。我不知道从哪里开始。
任何帮助都是非常感谢的。
发布于 2019-10-29 18:04:49
您可以在SmartFilterBar中添加您自己的字段,然后创建您自己的自定义过滤器:
https://sapui5.hana.ondemand.com/#/topic/3a515829ffd74239878ebc0d453d001d
编辑:,如果您想使用现有的字段,只需在beforeRebindTable事件上按一个带有sap.ui.model.FilterOperator.Contains的新筛选器即可。
步骤1:在manifest.json文件中注册您的扩展名
"extends": {
"extensions": {
...
"sap.ui.controllerExtensions": {
...
"sap.suite.ui.generic.template.ListReport.view.Details": {
...
"controllerName": "com.acme.app.controller.ListReportExtension",
...
}
}
...步骤2:实现控制器方法:
sap.ui.controller("com.acme.app.controller.ListReportExtension", {
onBeforeRebindTableExtension: function(oEvent) {
var oBindingParams = oEvent.getParameter("bindingParams");
oBindingParams.parameters = oBindingParams.parameters || {};
var oSmartTable = oEvent.getSource();
var oSmartFilterBar = this.byId(oSmartTable.getSmartFilterId());
var vCategory;
if (oSmartFilterBar instanceof sap.ui.comp.smartfilterbar.SmartFilterBar) {
//Custom price filter
var oCustomControl = oSmartFilterBar.getControlByKey("CustomPriceFilter");
if (oCustomControl instanceof sap.m.ComboBox) {
vCategory = oCustomControl.getSelectedKey();
switch (vCategory) {
case "0":
oBindingParams.filters.push(new sap.ui.model.Filter("Price", "LE", "100"));
break;
case "1":
oBindingParams.filters.push(new sap.ui.model.Filter("Price", "GT", "100"));
break;
default:
break;
}
}
}
}
});https://stackoverflow.com/questions/57553700
复制相似问题