Skip to main content
17 votes
Accepted

Dynamically created component with aura:id, set as a Facet inside a parent component, is not found when calling find() and passing in aura:id

This is a bug inside the framework where dynamically created components are not getting properly indexed to their parents. Doesn't look like anyone is actively working on it right now. If you'd like ...
TrevorBliss's user avatar
  • 3,833
11 votes
Accepted

How to migrate aura:id to Lightning Web Components

I have found the LWC docs to offload some of this to the MDN docs, so bringing this one layer higher (in the actual LWC docs would be nice) would have made it easier for us. In scenarios where there ...
tsalb's user avatar
  • 3,735
9 votes

Aura:Id of dynamically created compontns cannot be accessed

Sorry can't comment yet. But i have the same problem when using cmp.find() to get a dynamically created component the return value is always undefined. I even tried it with the code provided in the ...
HannesSchmidt's user avatar
8 votes
Accepted

document.getElementById("myId") vs component.find("myId").getElement();

Regardless of performance, you should use component.find. Document query selectors aren't recommended in lightning, whereas component.find has explicit support: Valid DOM Access The following methods ...
Adrian Larson's user avatar
  • 150k
8 votes
Accepted

Problems "find"ing a dynamically created child component

To attach the component(child) under a component(parent), you are doing following: 1.Create the component using $A.createComponent 2.Finding the parent component to attach the dynamic child using ...
Praveen's user avatar
  • 10.1k
7 votes

Aura:Id of dynamically created compontns cannot be accessed

I believe this issue is related to Dynamically created component with aura:id, set as a Facet inside a parent component, is not found when calling find() and passing in aura:id Have a look at the ...
Christian Menzinger's user avatar
7 votes
Accepted

Lightning Components: declare attributes or get the values from the DOM?

get is faster than find and then get, simply because the latter requires calling two methods while the former only requires one method. In addition, find may return either no values (null), one value (...
sfdcfox's user avatar
  • 495k
7 votes
Accepted

get values in lightning:input with $A.createComponents

In order to bind to something dynamically, you need a reference. Here is a very basic, no-frills, slightly buggy implementation that demonstrates that this basically works. Notice how I use component....
sfdcfox's user avatar
  • 495k
6 votes

Getting selected values in aura:iteration

To get the value selected you need to target the lightning:select and get his value, because if you target the options they will all have the same aura:id as it does not support expressions (so there'...
Nordine Hammache's user avatar
6 votes
Accepted

How to find a dynamically assigned aura:id?

aura:id can't be populated dynamically: aura:id doesn't support expressions. You can only assign literal string values to aura:id. Instead, give all of your <lightning:inputField> components ...
David Reed's user avatar
  • 93.2k
4 votes

Dynamically created component with aura:id, set as a Facet inside a parent component, is not found when calling find() and passing in aura:id

as @techbusinessman stated, the only workaround (so far) to get the value from a dynamically created component is to use : var value = component.get("v.*attributeName*").get("v.value");// for type="...
Hareesh Mohan's user avatar
4 votes

How to migrate aura:id to Lightning Web Components

The equivalent of using aura:id and component.find() in LWC is to use a standard DOM query selector like this: const element = this.template.querySelector('selector'); element.doSomething(); We do ...
POZ's user avatar
  • 4,409
4 votes
Accepted

Aura Iterate, get the aura:id of a span

When you're using normal HTML, you have a lot of flexibility in what you do with this. One solution not involving the use of id is to set a data attribute on the span: <aura:component> <...
sfdcfox's user avatar
  • 495k
4 votes
Accepted

Two aura:id for one lightning component. Is it possible?

Presuming that you're dynamically creating components (e.g. c1 and c2), you have total control over the aura:id. A component cannot define its own aura:id, only the aura:id for children within itself. ...
sfdcfox's user avatar
  • 495k
3 votes
Accepted

Show/Hide Multiple Div on basis of Aura:ID in Lightning?

First of all, you can use slds-hide, the SLDS built-in for hiding an element: $A.util.addClass(component.find("toggle1"), "slds-hide"); Second, you could have simply wrapped everything in a single ...
sfdcfox's user avatar
  • 495k
3 votes
Accepted

Set lightning component aura:id attribute dynamically while creating the component

You can specify aura:id in the createComponent call: $A.createComponent( "c:RPGFlowComponent", { "aura:id": "somevalue", // You can set whatever you like here flow: { ...
sfdcfox's user avatar
  • 495k
3 votes

Dynamically created component with aura:id, set as a Facet inside a parent component, is not found when calling find() and passing in aura:id

Here's an alternative workaround which seems much neater to me (set as an answer because it gives space for the code)... First declare an attribute to store dictionary object of aura:id to component: ...
Aidan's user avatar
  • 13.7k
3 votes

Aura:Id of dynamically created compontns cannot be accessed

This Bug has been resolved with Spring 18 release: Release Notes
Christian Menzinger's user avatar
3 votes

Aura:Id of dynamically created compontns cannot be accessed

YOu have to specify the type of component as "ui:inputselect" $A.createComponent( "ui:inputselect", { "class" : "slds-input ", "aura:id" : 'ExampleId', ...
Junaid P Khader's user avatar
3 votes
Accepted

Use id in aura:iteration for recordEditForm

aura:id can't be set dynamically via an expression. It is mentioned in the Component IDs documentation. aura:id doesn't support expressions. You can only assign literal string values to aura:id. at ...
Oleksandr Berehovskyi's user avatar
2 votes

Problems "find"ing a dynamically created child component

According to the Release Notes this will be fixed with Spring'18 in Jan/Feb 18. Find Dynamically Created Components You can now use cmp.find() to find a component that you create dynamically with $A....
itsmebasti's user avatar
  • 6,477
2 votes

Target an element with aura:id for CSS

The id will let you get a reference to a specific DOM element. aura:id will let you get a reference to a Component via component.find("yourAuraId"). Once you have a reference to the Aura component, ...
TrevorBliss's user avatar
  • 3,833
2 votes

In Lightning/Aura, is it possible to dynamically set the id for ui:inputText and ui:InputSecret?

Lightning aura:id attribute will not allow any dynamic/run time evaluated values, it just allows literal string. Alternate to this is include standard id attribute of html and access these in ...
Sharan Desai's user avatar
2 votes
Accepted

Workaround for static aura:id's on Lightning components

As far as I could understand, you are trying to open the SubItems view when button is clicked. To do this, you don't need to access the regular id of the button. Each instance of the component(i.ec:...
Praveen's user avatar
  • 10.1k
2 votes

Getting selected values in aura:iteration

As @Nordine Hammache said you need to to target the lightning:select. As per your code for getting value ,You need to create sub component. I have worked out similar example Component parent: <...
vignesh's user avatar
  • 2,704
2 votes
Accepted

Component.find(namespace:componentName) : Finding Component By Type

According to this documentation (page 110) this syntax should work: var checkboxes = component.find({ instancesOf : "ui:inputCheckbox" });
itsmebasti's user avatar
  • 6,477
2 votes
Accepted

Get data from inner component present inside aura iteration in parent component

I don't think this is appropriate way to do so in lightning. One way to do say by firing a event from inner component whenever the value changes in inner component. You can fire event with both ...
Manjot Singh's user avatar
  • 3,516
2 votes
Accepted

How to find id of lightning component tag which defined in iteration?

Use aura:id, instead: <div aura:id="option" data-index="{!i}" data-id="{!item.Id}" onclick="{!c.jsFunction}"><text-under-div></div> var options = component.find("option"); options =...
sfdcfox's user avatar
  • 495k
2 votes
Accepted

Input field not getting populated when selecting multiple records in a table as aura:id does not support dynamic id

when you use component.find from Aura:iteration it gives array of components if that aura:iteration had more than one items, so you 'll to get list of distance values if aura:iteration had more than ...
sdandamud1's user avatar
  • 2,705
2 votes

Not able to set value using aura:id ,in aura:iteration

From documentation, If the local ID is unique, find() returns the component If there are multiple components with the same local ID, find() returns an array of the components If ...
salesforce-sas's user avatar

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