You need to sign in to do that
Don't have an account?
Soundhariyaa M
How to call a helper method from another helper method
Hi,
Suppose I have
a:funtion(component,event)
{
},
b:function(component,event,page)
{
}
And I wanted to call b() from a()
where page is a Integer.
How can I do this?
I tried the one given below but it didn't work
a:funtion(component,event)
{
this.b(component,event,1);
},
b:function(component,event,page)
{
}
Can anyone help me
Suppose I have
a:funtion(component,event)
{
},
b:function(component,event,page)
{
}
And I wanted to call b() from a()
where page is a Integer.
How can I do this?
I tried the one given below but it didn't work
a:funtion(component,event)
{
this.b(component,event,1);
},
b:function(component,event,page)
{
}
Can anyone help me
a:funtion(component,event)
{
var helper = this;
…………
. helper.b(component,event,1);
}
All Answers
As mentioned in this link: https://na93.salesforce.com/chatteranswers/ChatterAnswersQuestionSingleItem.apexp?id=9062I000000QwnU can you please have a look at the implementation and in case if that helps can you please mark it as best answer so that it can be used by others in the future.
Regards,
Anutej
a:funtion(component,event)
{
var helper = this;
…………
. helper.b(component,event,1);
}
Instead this.b(component,event,1); I tried your solution.
But could you tell why this.b(component,event,1); didn't work and assigning this to helper variable and calling it using helper variable worked
You can treat controller method as per instance, helper method is shared by instances. That is how controller and helper work.