格式化程序parameter passing为null

我正试图将表格数据导出到Excel工作表。 一切正常,没有格式化。 但是在将表格转换为Excel之前,我必须格式化一些单元格。 我正在debugging代码。 格式化函数的参数作为空值传递。 这是我的代码:

var oExport = new sap.ui.core.util.Export({ exportType: new sap.ui.core.util.ExportTypeCSV({ separatorChar: ";" }), models: this.getView().getModel(), rows: { path: "/FaaliyetServisiSet" }, columns: [{ name: "Kişi", template: { content: "{Klnad}" } }, { name: "Faaliyet", template: { content: "{Falyt}" } }, { name: "Süre", template: { content: { parts: ["Sure"], formatter: function(oValue) { // oValue is null that's the problem !!!!!!! oValue = oValue + 2; return oValue; } } } }, { name: "Proje", template: { content: "{Proje}" } }, ] }); 

我在某些数据绑定用例中遇到类似的问题。 格式化函数被调用,初始数据绑定值可以是null或undefined。 我通过简单的null和undefined检查来忽略formatter函数的调用,从而避免了这个问题。

您应该使用一组对象而不是部分string

 parts: [ { path: "Sure" } ] 

https://openui5.hana.ondemand.com/#docs/guide/07e4b920f5734fd78fdaa236f26236d8.html

Interesting Posts