Skip to Content
0

Sapui5 formatter function not found!

Jul 28, 2017 at 07:48 PM

807

avatar image

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

7 Answers

Ian McCallum
Nov 29, 2017 at 01:15 AM
2

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.

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

this probably will solve the problem

0
Jun Wu Jul 28, 2017 at 09:13 PM
0

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)

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Nov 09, 2017 at 10:53 AM
0

same issue im facing now

Share
10 |10000 characters needed characters left characters exceeded
Shujian Wei Nov 23, 2017 at 01:54 PM
0

Hi,

I got same issue, did you have solve this?

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jan 05 at 10:29 AM
0

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

Show 1 Share
10 |10000 characters needed characters left characters exceeded

check Former Member 's answer

0
avatar image
Former Member Feb 05 at 01:12 PM
0

//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>
Share
10 |10000 characters needed characters left characters exceeded
Moises Gomez Quintero Apr 03 at 01:38 AM
0

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

Greetings !!.

Share
10 |10000 characters needed characters left characters exceeded