0
votes

I want show only row where property title!==null

var filter = new sap.ui.model.Filter({path:"title",test:function(oValue){
return oValue!==null;
}
});

but I haìve an error: Wrong parameters defined for filter. This is the API that I use: https://openui5.hana.ondemand.com/docs/api/symbols/sap.ui.model.Filter.html

How can I set my filter correctly?

I have updated the runtime and now I can use my personal test function to test tileds!

1
What version of UI5 are you using?qmacro
1.24.3 it is a version problem?padibro

1 Answers

2
votes

The ability to specify a function for the test property of the parameter map appeared in 1.26. In the previous version 1.24 this was not possible. From your comments you're running 1.24, hence the error.

FWIW, here's the detail from sap/ui/model/Filter.js in 1.24 vs 1.26:

1.24: /** * Constructor for Filter * You can either pass an object with the filter parameters or use the function arguments * * Using object: * new sap.ui.model.Filter({ * path: "...", * operator: "...", * value1: "...", * value2: "..." * }) * * OR: * new sap.ui.model.Filter({ * filters: [...], * and: true|false * })

1.26: /** * Constructor for Filter * You can either pass an object with the filter parameters or use the function arguments * * Using object: * new sap.ui.model.Filter({ * path: "...", * operator: "...", * value1: "...", * value2: "..." * }) * * OR: * new sap.ui.model.Filter({ * path: "...", * test: function(oValue) { * } * }) * * OR: * new sap.ui.model.Filter({ * filters: [...], * and: true|false * })