Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Formatter parameter is null

Hi,

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}"
              }
             },

           ]
          });

Tags:
replied

This solved the problem:

{
              name : "Süre",
              template : {
               content : {
                parts : [ "Sure" ],
                formatter : function(
                  oValue) {
                 if (oValue == null)
                  return oValue;
                 return oValue + 2;
                  
                }
               }

              }
             },

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question