I am trying to export table data to an Excel sheet. Everything works OK without formatter. But I have to format some cells before converting table to Excel. I'm debugging the code. Formatter function's parameter passes as null value. Here is my code:
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}"
}
},
]
});
I´m facing a similar issue in some data binding use cases. The formatter function gets called with the initial data binding value which can be null or undefined. I circumvent this issue by ignoring calls of the formatter function by simple null and undefined checks.