You need to sign in to do that
Don't have an account?

Accessing Parent Element of a lightning component through a Child Element Component
Hello,
I have to access aura:id of a div in component through a button in nested componet.
Can anyone help me with this??
Thanks
I have to access aura:id of a div in component through a button in nested componet.
Can anyone help me with this??
Thanks
you can do this with lightning Event , can you send me your code so i tell you how to use event on component :)
Thanks :)
The code is like:
component:
<aura:component>
<ui:button aura:id="button" class=" slds-button slds-button--neutral slds-float--right" press="{!c.applycss}">New Account</ui:button>
<div aura:id="Component" class="slds-box slds-theme--default Hide">
<c:accounts/>
</div>
</aura:component>
controller-
applycss:function(cmp,event){
var cmpTarget = cmp.find('Component');
$A.util.removeClass(cmpTarget, 'Hide');
$A.util.addClass(cmpTarget, 'parent');
}
accounts component:
<aura:component>
<ui:button aura:id="button1" class="slds-button slds-button--neutral slds-not-selected" press="{!c.removeCss}">Submit</ui:button>
</aura:component>
controller-
removeCss: function(cmp, event) {
var cmpId = cmp.find('Component');
$A.util.removeClass(cmpTarget, 'parent');
$A.util.addClass(cmpTarget, 'Hide');
}
i understand what you want, you want change css of parent component from child componet i am right ?
so, you can not access another component directly so first you create a lightning event.
developer-Console -----new -----lightning event
ComponentEvent.evt
parentComponent.cmp parentComponentController.js
childComponent.cmp
childComponentController.js
* underline text must be same name
create a dummy app with component and event and understand properly
Thanks :)
If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.
If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.
Hello {!Piyush_soni__c},
I need to do something similar, can you help me?

ModalFooterController.js ModalBody.cmpI'm using lightning:overlayLibrary to make a modal popup with Header and Footer and Body with force:recordEdit, like this below.
I need that when teh user click on Salvar (Save) button in ModalFooter.cmp, the function handleSave on ModalBodyController.js be fired, to save form updates. I tried use aura:event but does not work.
ModalFooter.cmp
mainComponent.cmpModalBodyController.js
mainComponentController.js