Tweeted twitter.com/StackSalesforce/status/1037309438892363776
    Bumped by Community user
2 added 6 characters in body
source | link

I am new to this. Based on our project req. I have to create unique aura:id to support dynamic appending of elements. I researched on this aura:id does not support expression. Two question

  1. Can I use global id like <a id = "{! GlobalId + '_tab' + index}"> where anchor tag will be in an iteration; so that i have a unique id for each anchor tag.

  2. How can i get this unique id; the way i am using right now is

var globalId = component.getGlobalId(); globalId = globalId + "_tab0"; var

var activeTab = component.find(globalId); $A

$A.util.addClass(activeTab,'slds-active');

I am getting the global id but how to find an element with global id?

Is this approach right?

I am new to this. Based on our project req. I have to create unique aura:id to support dynamic appending of elements. I researched on this aura:id does not support expression. Two question

  1. Can I use global id like <a id = "{! GlobalId + '_tab' + index}"> where anchor tag will be in an iteration; so that i have a unique id for each anchor tag.

  2. How can i get this unique id; the way i am using right now is

var globalId = component.getGlobalId(); globalId = globalId + "_tab0"; var activeTab = component.find(globalId); $A.util.addClass(activeTab,'slds-active');

I am getting the global id but how to find an element with global id?

Is this approach right?

I am new to this. Based on our project req. I have to create unique aura:id to support dynamic appending of elements. I researched on this aura:id does not support expression. Two question

  1. Can I use global id like <a id = "{! GlobalId + '_tab' + index}"> where anchor tag will be in an iteration; so that i have a unique id for each anchor tag.

  2. How can i get this unique id; the way i am using right now is

var globalId = component.getGlobalId(); globalId = globalId + "_tab0";

var activeTab = component.find(globalId);

$A.util.addClass(activeTab,'slds-active');

I am getting the global id but how to find an element with global id?

Is this approach right?

1
source | link

Finding a component using Global Id : salesforce lightning

I am new to this. Based on our project req. I have to create unique aura:id to support dynamic appending of elements. I researched on this aura:id does not support expression. Two question

  1. Can I use global id like <a id = "{! GlobalId + '_tab' + index}"> where anchor tag will be in an iteration; so that i have a unique id for each anchor tag.

  2. How can i get this unique id; the way i am using right now is

var globalId = component.getGlobalId(); globalId = globalId + "_tab0"; var activeTab = component.find(globalId); $A.util.addClass(activeTab,'slds-active');

I am getting the global id but how to find an element with global id?

Is this approach right?