Skip to Content

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

util.Formatter.js function in JS View

Hi Expert.

I am trying to complete "Building SAP Fiori-like UIs with SAPUI5" exercise 3 in JS view.

I have problem in calling statusText function of util.Formatter.js in my Detail.view.js.

The original exercise is in xml view.

Below is my codes..

Formatter.js

jQuery.sap.declare("myFioriApp.util.Formatter");

myFioriApp.util.Formatter = {

statusText : function(value) {

var bundle = this.getModel("i18n").getResourceBundle();

return bundle.getText("StatusText" + value, "?")

}

}

Detail.view.js

sap.ui.jsview("myFioriApp.Views.Detail", {

getControllerName : function() {

return "myFioriApp.Views.Detail";

},

createContent : function(oController) {

var oHeader = new sap.m.ObjectHeader({

firstStatus: new sap.m.ObjectStatus(

{text:{

formatter: function(s){

return myFioriApp.util.Formatter.statusText(s)

}}})}

}

Function statusText() did get called but (this.) does not have an instance of text control therefor it fails to call getModel() function of it's aggregate.

Thanks in advance for your reply.

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question