cancel
Showing results for 
Search instead for 
Did you mean: 

Sapui5 formatter function not found!

0 Kudos

Hi to all,

I'm trying to use a formatter function in my app to give format to an sap datetime data, when I declare it in controller file it works fine, but when I try to call it from formatter file I get message: "formatter function .formatter.toTime not found!".

This is my file definition:

This is how I prepared it in my controller file:

this is how I call it from my view:

And finally, this is the message that I receive :

Does anybody could help me to find the cause of this issue ?

Greetings,

Moisés.

Accepted Solutions (1)

Accepted Solutions (1)

ianfmccallum
Explorer

The order of the items you are importing and the order of the dependency injections must match in your controller. Try switching 'MessageBox' and 'formatter.' That worked for me.

Former Member

this probably will solve the problem

Answers (7)

Answers (7)

former_member606992
Discoverer
0 Kudos

Moises Gomez Quintero thanks for the help resolved my issue.

rakesh2901
Participant
0 Kudos

Hello Taksh,

I am facing same issue, I even sequenced the calls as suggested by former member . Still facing the same issue. Can you pease tell me what is it that I am missing.

I am having exact same issue as in this question

Rakesh

0 Kudos

Thanks to all of you, Per Bengtson I´m gonna do changes in code and test it again,

Greetings !!.

Former Member
0 Kudos


//To clarify for us beginners; declarations in "sap.ui.define" and 
// "function" must have same sequence.
// Eg here is "formatter" last in both cases, works very well.
//Below are the first lines from "View1.controller.js" as an example

sap.ui.define([
'jquery.sap.global',
'sap/m/MessageToast',
'sap/ui/core/Fragment',
'sap/ui/core/mvc/Controller',
'sap/ui/model/Filter',
'sap/ui/model/json/JSONModel',
'myApp/model/formatter'

], function(jQuery, MessageToast, Fragment, Controller, Filter, JSONModel, formatter) 
	"use strict";
	return Controller.extend("myApp.controller.View1", {		
		formatter: formatter,

        onInit : function(){...
<br>
Former Member
0 Kudos

Hi,

I am also facing the same issue. Getting an error that function in the formatter is not found. Anyone found the solution for this issue?

Regards

Karthik S

former_member185414
Active Contributor
0 Kudos

check ian.f.mccallum 's answer

0 Kudos

Hi,

I got same issue, did you have solve this?

Former Member
0 Kudos

same issue im facing now

junwu
Active Contributor
0 Kudos

1.check if the formatter js is loaded.

2. "formatter" is used both as key and value, can you change that?( not sure if it matters)