I have this code in component helper:

func1:function (component){

  var element = component.find("calendar").getElement();
             views: {
                   year: { // name of view
                   columnFormat: 'MMM'
                     // other view-specific options here
            } ,
               header: {
                left: 'prev,next today',
                center: 'title',
                right: 'year,month,basicWeek,basicDay'

            viewRender: function(view){
                console.log("**** "+view.name);

but it display an error indicate that func2 is not defined so how can I call helper function from inner functions?

1 Answer 1


You need a reference outside the inner function to this:

// in outer function
var self = this;



When a method is called, "this" is typically set to the object that called the function. Sometimes it's hard to tell what "this" even is. Most likely, "this" inside your particular function refers to the FullCalendar module, or perhaps jQuery, but most certainly doesn't refer to the helper object.

As an alternative, you can use arrow functions, but be aware that IE does not support them (but Edge does).

viewRender: (view) => { this.func2(component); }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.