[英]Passing filters in OData service SAP UI5 to ABAP
I am reading two parameters from URL.我正在从 URL 读取两个参数。
var spayid = jQuery.sap.getUriParameters().get("payid");
var spaydt = jQuery.sap.getUriParameters().get("paydt");
Now I have to pass these two filter options in my odata service.现在我必须在我的 odata 服务中传递这两个过滤器选项。
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})
Entity Name= PDetailSet Field name for spayid is Laufid and spaydt is Laufdt.实体名称= PDetailSet spayid 的字段名称是 Laufid,spaydt 是 Laufdt。
Please help how to pass filters in odata service.请帮助如何在 odata 服务中传递过滤器。
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. model 本身不能过滤,但绑定可以。 So if you bind your dataset to a table ie you could filter that binding with your filters, as described in your comments.
因此,如果您将数据集绑定到表,即您可以使用过滤器过滤该绑定,如您的评论中所述。
That would look like this:看起来像这样:
oTable.getBinding("rows").filter(filter1);
To combine your two filters, you can use another filter, which has the advantage that you can decide wheter to use "and" or "or".要组合您的两个过滤器,您可以使用另一个过滤器,它的优点是您可以决定是使用“and”还是“or”。 You can see a detailed example for that in the documentation .
您可以在文档中查看详细示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.