A formatter can be defined either globally, for the entire application, or in your controller.
Define a formatter as follows:
Defining a formatter in controller.js:
#!js
myFormatter: function(sName) {
return sName.toUpperCase();
},
myGenderFormatter: function(sGender) {
var sValue = "Mr.";
if (sGender === "female") {
sValue = "Mrs.";
}
return sValue;
}
Defining a global formatter in the SAPUI5 application:
#!js
<script type="text/javascript">
// define a global formatter function
var my = {};
my.globalFormatter = function(iDay,iMonth,iYear) {
return iDay + "/" + iMonth + "/" + iYear;
}
...