cancel
Showing results for 
Search instead for 
Did you mean: 

Formatter parameter is null

former_member253610
Participant
0 Kudos

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

           ]
          });

Accepted Solutions (1)

Accepted Solutions (1)

former_member253610
Participant
0 Kudos

This solved the problem:


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

              }
             },

0 Kudos

hi Efecan, this helped me a lot.

I had to fix the break line inside a cell issue, with the formatter I could surround the text with " and the problem was solved.

*sad that it is not well documented, a lot of time wasted searching a solution.

thanks. Cristiano

Answers (1)

Answers (1)

PMarti
Active Participant
0 Kudos

Hi Efeca, try:


...

content : { 

        path : "Sure", 

        formatter : function(oValue){

                                     oValue = oValue + 2; 

                                     return oValue; 

                            }

... 

Regards,

Pau

former_member253610
Participant
0 Kudos

Hi Pau,

Thanks for your reply. I'm still getting null.

former_member182372
Active Contributor
0 Kudos

"delay" saveFile for half second, like

jQuery.sap.delayedCall(500, this, function () {

   oExport.saveFile("abc").always(function () {

   this.destroy();

  });

});

former_member253610
Participant
0 Kudos


Thanks for your reply. But it didn't work. It's still null. I tried:

jQuery.sap.delayedCall(4000, this, function() { //4000 to be sure

         oExport.saveFile("Faaliyet").always(
           function() {

            this.destroy();

           });

        });