问题描述
我正在从URL中读取两个参数.
I am reading two parameters from URL.
var spayid = jQuery.sap.getUriParameters().get("payid");
var spaydt = jQuery.sap.getUriParameters().get("paydt");
现在,我必须在我的odata服务中传递这两个过滤器选项.
Now I have to pass these two filter options in my odata service.
this.getView().setModel(new ODataModel("proxy/http/FIORI-DEV.abc.com:8000/sap/opu/odata/sap/Z_OD_SRV/?sap-client=100", {
json : true,
useBatch : false})
实体名称= PDetailSetspayid的字段名称是Laufid,而spaydt的字段名称是Laufdt.
Entity Name= PDetailSetField name for spayid is Laufid and spaydt is Laufdt.
请帮助如何在odata服务中通过过滤器.
Please help how to pass filters in odata service.
注意:我还通过以下方式添加了过滤器.
NB: I have also add the filters in the following way.
var filter1= new sap.ui.model.Filter(
{ path: "Laufi", operator: sap.ui.model.FilterOperator.EQ, value1: spayid });
var filter2= new sap.ui.model.Filter(
{ path: "Laufd", operator: sap.ui.model.FilterOperator.EQ, value1: spaydt });
推荐答案
模型本身无法过滤,但绑定可以过滤.因此,如果您将数据集绑定到表,即可以按照评论中的描述使用过滤器过滤该绑定.
A model itself can not be filtered, but a binding can. So if you bind your dataset to a table i.e. you could filter that binding with your filters, as described in your comments.
它看起来像这样:
oTable.getBinding("rows").filter(filter1);
要组合两个过滤器,可以使用另一个过滤器,其优点是可以决定先使用"and"还是"and".或或".您可以在文档.
To combine your two filters, you can use another filter, which has the advantage that you can decide wheter to use "and" or "or". You can see a detailed example for that in the documentation.
这篇关于将OData服务SAP UI5中的过滤器传递给ABAP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!