2015-03-02 65 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