27 votes
Accepted

How do I debug my lightning component?

General Tools and settings: use Chrome + built in Dev Tools + Lightning Component Inspector be sure debug mode is enabled in your org (Setup: Lightning Components) be sure caching is disabled in your ...
user avatar
19 votes
Accepted

What are the outer parentheses in Lightning controllers?

This choice was made for two reasons. We parse the Controller and Helper on the server to validate them. There are many different Java Parsers of JSON we could use, but regardless which we choose we ...
user avatar
  • 3,106
17 votes
Accepted

Helper method error: says is "Not a function"

I think the problem is with your doInit function. The helper is passed to the function as the third argument: doInit : function(component, event, helper){
user avatar
  • 12.2k
14 votes
Accepted

Sharing JavaScript between multiple Lightning Components

Currently the recommended mechanism for this is to use a Static Resource and include it in any components that need to share the same JavaScript via ltng:require (loads the library once and only once ...
user avatar
  • 9,974
11 votes
Accepted

Lightning response.getReturnValue() question

It is a JavaScript object - the JSON has already been parsed. To inspect simple JavaScript objects use JSON.stringify: console.log('currency data is:' + JSON.stringify(actionResult.getReturnValue()))...
user avatar
  • 129k
10 votes
Accepted

How to add extra data to a ui:button in a Lightning Component?

You could just extend ui:button and add an attribute. Eg, <!--<c:myNewUIButton>--> <aura:component extends="ui:button"> <aura:attribute name="someAttribute" type="string" /&...
user avatar
10 votes
Accepted

lightning:input help -- keyCode

lightning:input does a bunch of validation and other stuff, but doesn't appear to support basic events other than blur, focus, and change events. However, if you want to add some basic key detection, ...
user avatar
  • 430k
10 votes
Accepted

How to access child Web Component property from parent Aura Component controller?

Is it possible to read child Web Component property from parent Aura Component? Yes you can. you are trying to call a method or a property in your LWC component from aura component the LWC way but ...
user avatar
  • 7,521
9 votes

What are the outer parentheses in Lightning controllers?

The various parts - controllers, helpers and the XML components themselves - are all assembled into a valid single JavaScript file that represents the component. So the pieces you edit are in a ...
user avatar
  • 129k
9 votes
Accepted

eval() in Lightning Web Components

The syntax for the second eval() misses this keyword while referring object_1 connectedCallback() { this.object_1 = "test"; console.log(" 1: " + eval("this.object_" + 1) + " 2: " + ...
user avatar
8 votes
Accepted

How to get the display density in a lightning components controller?

You can get Display density information using Salesforce User Interface API. This Link will help you. I don't think you can directly access Salesforce UI-API from Lightning controller, but you can use ...
user avatar
  • 489
7 votes
Accepted

Helper function not getting recognised intermittently

I believe the order of the params is wrong here: function(component, helper, event) Should be: function(component, event, helper)
user avatar
  • 53.1k
7 votes
Accepted

Is it possible to clear force:inputField?

Theoretically it should be possible to clear values on force:inputField. But in your specific case it seems not to work as expected. force:inputField is a smart field component operating on different ...
user avatar
  • 33.5k
7 votes
Accepted

How to load and use external library?

Using webcomponents and Jquery together can get bit tricky . Here is how i approached this and got it working 1.Create a zip file that has latest jquery.min.js , pagination.js and pagination.css ...
user avatar
6 votes
Accepted

lightning callback not firing

According to this post, "a javascript method name in a component controller can never be the same name in an apex lightning controller": Enqueued action not executed in Lightning Component Just need ...
user avatar
  • 623
6 votes

aura: method to call child component controller function not working

I did the following and it worked just fine. So start here and add in stuff till it breaks. This is essentially what you posted since the rest of your code is missing. Parent Component <aura:...
user avatar
  • 53.1k
6 votes
Accepted

Component Initilization Error: cannot read property 'g'

Looks like your event handler declaration is causing the problem. <aura:handler name="QuestionAddedEvent" value="{!this}" action="{! c.reloadQuestions }"/> You should not be using value="{!...
user avatar
  • 1,969
6 votes
Accepted

Extracting a callback function

The controller of a component has no this context, only the helper does. There are ways of calling one method from another via something like: let action = component.get("c.cbFunction"); $A....
user avatar
  • 430k
6 votes
Accepted

Does more logic on Client side reduces the lightning performance?

Lightning Component Framework is optimized for performance. So unless and until you have things really going bad, you should be good if you implement your component using Lightning Components ...
user avatar
  • 28.9k
6 votes
Accepted

Lighting Components: Dynamically Call Aura Method

Sure, you can dynamically call aura method accessing a function through the bracket notation []: var methodName = 'myMethod' ; var childCmp = component.find('childCmp'); childCmp[methodName]();
user avatar
5 votes
Accepted

$A.util.removeClass not working in some cases

Instead of doing things in init, try it in afterRenderer. Reason is that init is called long before DOM availability, which might cause a timing issue. Incase of afterRenderer it is called only after ...
user avatar
  • 10.1k
5 votes

action.setCallBack() - call Back failed in lightning application

Your callback has an empty function body, because the second parentheses closes the function body prematurely. Honestly, I'm surprised this compiled at all. It should look more like: getMyContacts : ...
user avatar
  • 430k
5 votes
Accepted

How to add dynamic variable to custom label in lightning javascript helper class

The framework provides a format function for this purpose e.g. with the label: Hello {0} and {1} the code could be: {!format($Label.mySection.myLabel, v.attribute1, v.attribute2)}
user avatar
  • 129k
5 votes
Accepted

Locker Service and Fullcalendar.io

Logan, I just happen to have a sample of Fullcalendar which displays events. But heads up .. it is not locker compatible. even though I have used ( Full Calendar: 3.1.0 & jQuery 2.2.4 ) as ...
user avatar
  • 1,969
5 votes

urlEvent is undefined

Just a different way to slice the pie I guess but this puts the pieces where they belong IMHO and leave lightning in lightning and classic in classic Lightning App <aura:application access="...
user avatar
  • 53.1k
5 votes
Accepted

Lightning addEventListener to li

I'm going to assume that you have more than one <li> item for this answer. You need to run this code in the renderer (or use the newly added event for Summer 17 - we'll use the renderer for now ...
user avatar
5 votes
Accepted

Param passed from Lightning Component to Apex controller is read as null

I'm pretty sure its just because your setParam should be setParams(---) instead. documented example at Calling a Server-Side Action action.setParams({ firstName : cmp.get("v.firstName") });
user avatar
  • 19.2k
5 votes
Accepted

Array.filter() in Lightning Components

You are turning your array into a string: let questionArray = JSON.stringify(component.get("v.questions")); // ^^^^^^^^^^^^^^^ ^ If v.questions is an ...
user avatar
  • 142k
5 votes
Accepted

Passing sObject List from Client Controller to Server Controller (Lightning Components)

setParam expects two parameters, a name and the value to set. Either use setParams, or use the correct setParam syntax: action2.setParam("openOpps", oppList); It is generally not necessary ...
user avatar
  • 430k
5 votes

Does more logic on Client side reduces the lightning performance?

Aside from Jayant's excellent answer, it's worth noting that JavaScript is faster than Apex, hands-down. Whenever Visualforce started to have issues with rendering a page, the immediate solution is to ...
user avatar
  • 430k

Only top scored, non community-wiki answers of a minimum length are eligible