Skip to Content

Sapui5 formatter function not found!

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

7 Answers

  • Nov 29, 2017 at 01:15 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 28, 2017 at 09:13 PM

    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)

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 09, 2017 at 10:53 AM

    same issue im facing now

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 23, 2017 at 01:54 PM

    Hi,

    I got same issue, did you have solve this?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 05 at 10:29 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 05 at 01:12 PM
    
    //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>
    Add comment
    10|10000 characters needed characters exceeded

  • Apr 03 at 01:38 AM

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

    Greetings !!.

    Add comment
    10|10000 characters needed characters exceeded