We have created a lookup component that we are reusing throughout our lightning app. Because these lookups are under each other, I would like to have all other the drop downs be closed as soon as one opens up.

This sounds easy, but with LockerService, I can't access the DOM directly and thought I could use Lightning Events for this functionality.

I have now created a custom event, have it fire when a dropdown opens and have the same lookup component handle it and close it if its a different one than the one I just opened up.

I think this sounds like a good solution, except it seems that only the component instance that fired the event is the only one that is handling the event.

I couldn't find anything about it in the documentation so I'm asking here; can you have a custom event be handled multiple times?

Thank you so much for any help you might be able to give!

  • I think there is some issue with your code. Ideally it should work. We have done this before. If you cant show all of your code, but come with small POC that can clue us whats wrong with your code. BTW, you should use application event only, not component event. – user533 May 27 '19 at 0:36

This is possible if you define your event as an APPLICATION event:

<aura:event type="APPLICATION"/>
  • This is not making a difference for me. Still only received by the component instance that sent it. – joshuadelange Mar 10 '17 at 14:43
  • So please share your code so I can see where the problem is – Itai Shmida Mar 11 '17 at 21:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.