I am using component.find(aura_id) to get the component. I have multiple components with the same aura_id So I am getting a list.

My question: What is the basis of the ordering of list returned by component.find()?

  • 1
    I think it should be same as you are seeing in the UI. Dec 15 '17 at 8:36
  • Unfortunately, I am observing different behavior. Dec 15 '17 at 9:52
  • 1
    Ideally you should not be dependent on the ordering of component retrieved by component.find.
    – Raul
    Dec 15 '17 at 10:05
  • I have two UI component returned by component.find(). In which at the place of the first UI component I am creating a new component and the previous one is destroyed. But In the list returned by component.find() the newly created UI component is at index 1. which should be at index 0 by the order in which we are seeing. The old component has been moved to index 0 from 1. Dec 15 '17 at 10:05
  • 1
    Relying on undocumented ordering would be very risky. Add an explicit attribute to the component to encode the information you need and so tell the difference between the instances.
    – Keith C
    Dec 15 '17 at 13:34

Your Answer

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

Browse other questions tagged or ask your own question.