Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2895

Problem with multiple formatter functions in Formatter.js (new version)

$
0
0

Hi specialists,

 

I have a question to the well known usage of formatter functions. Using SAP WEB IDE
and the template functions the system generates an default formatter module with following
source code:

 

Formatter.js

------------------

 

sap.ui.define([], function() {

  "use strict";

  return {

 

// My own function

  getLocaleDateTimeStr: function(datetime) {

  return datetime ? datetime.toLocaleString() : "";

  }

 

  };

});

 

This is working and the SAP WEB IDE Editor shows no error messages. OK...

 

Now my "simple" requirement is to extend this formatter function with other
-usefull- formatting functions.

 

My problem is the (not known) notation form of additional functions. Following code
will not be accepted from the WEB IDE edtitor (compare screenshot).

 

Again complete Formatter.JS code:

===========================

 

sap.ui.define([], function() {

  "use strict";

  return {

 

 

  getLocaleDateTimeStr: function(datetime) {

  return datetime ? datetime.toLocaleString() : "";

  }

 

// additional function, now problems...   

 

        getDateTimeInst: function(value) {

           var oDateFormat = sap.ui.core.format.DateFormat.getDateTimeInstance({ pattern: "dd.MM.yyyy" });

           return oDateFormat.format(new Date(value));

      }

 

  };

});

 

==> Error message from the Editor (unexpected identifier) on level getDateTimeInst: ...

 

Thanks

Klaus Wegener


Viewing all articles
Browse latest Browse all 2895

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>