After some Googling, I figured I need the URL to be
...$filter=year(DateTimeProperty) eq 1990
I am not so sure how to achieve such a filter query using sap.ui.model.Filter in UI5.
sap.ui.model.Filter
Any help is appreciated.
You can create the filter like this:
const oFilter = new sap.ui.model.Filter("year", sap.ui.model.FilterOperator.EQ, "1990");
There are multiple ways how to use this filter. If you have an element which is already bound:
this.byId("sListId").getBinding("items").filter(oFilter);
Obviously you need to adjust the id and binding. Or you can create a new binding where you pass the filter to the constructor
new sap.ui.model.odata.v4.ODataListBinding(oModel, sPath, oContext, vSorters, vFilters, mParameters)
Here is the API for OData v4 Listbindings https://sapui5.hana.ondemand.com/1.86.0/#/api/sap.ui.model.odata.v4.ODataListBinding%23methods/filter and here is some documention about filter and OData V4 https://sapui5.hana.ondemand.com/1.86.0/#/topic/426ff318051a465191c861b51a74f00e
2.1m questions
2.1m answers
60 comments
57.0k users