2015-03-02 67 views
0

当“的过滤器定义的参数错误”我想只显示一行,其中财产title!==null错误指定的测试参数

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

但我haìve错误:Wrong parameters defined for filter. 这是我使用的API:https://openui5.hana.ondemand.com/docs/api/symbols/sap.ui.model.Filter.html

如何正确设置我的过滤器?

我已经更新了运行时间,现在我可以使用我的个人测试功能来测试平铺!

+0

什么版本UI5您使用的是? – qmacro 2015-03-02 13:44:55

+0

1.24.3这是一个版本问题? – padibro 2015-03-02 15:54:00

+0

ui5bp.modelManager解决了什么问题?它是否在'simpleTable'函数的上下文中可见? – Qualiture 2015-03-04 08:42:12

回答

1

在1.26中出现了为参数映射的test属性指定函数的功能。在以前的版本1.24中,这是不可能的。从你的评论你运行1.24,因此错误。

FWIW,这里是从SAP/UI /模型/ Filter.js在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 * })

+0

好吧我已经更新了运行时间,但现在我有另一个问题。我已更新Q. – padibro 2015-03-04 08:35:01

+1

请不要这样做 - 即在回答第一个问题时将一个问题变为另一个问题。请撤销您的更改,并适当标记此答案,并打开一个新问题。 – qmacro 2015-03-04 15:02:57

+0

我已经创建了另一个问题http://stackoverflow.com/questions/28881106/filter-test-function-not-start-when-parameter-is-null – padibro 2015-03-05 15:12:58