Skip to content

Instantly share code, notes, and snippets.

@srujan21
Last active October 1, 2019 08:24
Show Gist options
  • Save srujan21/50df382f1e4ba993b6d4ae8582fea8d2 to your computer and use it in GitHub Desktop.
Save srujan21/50df382f1e4ba993b6d4ae8582fea8d2 to your computer and use it in GitHub Desktop.
Set custom attribute on component and Retrieve that in controller
<div class="slds-truncate" style ="text-align : center;" title="{!$Label.c.Selection}" data-selected-Index = "{!com.key}" onclick ="{!c.setKey}">
<lightning:input aura:id="selectedRange" name="radioButton" type="radio"/>
</div>
setKey: function(component, event,helper) {
var target = event.currentTarget;
var dataEle = event.currentTarget.getAttribute("data-selected-Index");
console.log("v.selectedItem", "Component at index "+dataEle+" has value "+target.value);
component.set("v.commsListKey", dataEle);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment