【发布时间】:2017-01-19 07:34:21
【问题描述】:
我尝试使用 sap.ui.model.Filter 过滤 DateTime 数据:
oTableSearchState = [new Filter([
new Filter("Date", FilterOperator.Contains, sQuery),
new Filter("Another_Date", FilterOperator.Contains, sQuery),
])]
它返回400 Bad String。我发现odata请求是...$filter substringof(,Date)。所以我知道使用“字符串过滤器”过滤日期是不正确的。
我需要的是...$filter= Date ge datetime'2016-08-17T16:00:00Z' and Date lt datetime'2016-08-18T16:00:00' 我可以用 sap.ui.model.Filter 做到这一点吗?或者唯一的方法是我自己将过滤器参数放在一起?
【问题讨论】:
-
我认为您应该创建一个自定义过滤器测试功能,而不是使用通用过滤器。 new Filter({ path: "...", test:
}) (sapui5.hana.ondemand.com/#docs/api/symbols/…)