Activity Forums Salesforce® Discussions Can component.find() find a dynamically created component in salesforce?

  • Kumar

    Member
    January 12, 2017 at 2:48 pm

    Hi Sushant,

    Yes, it can. To this you have to roughly follow these steps:

    1. Create the component using $A.createComponent
    2. Finding the parent component to attach the dynamic child using component.find(parentId) which returns the  component instance(Aura.Component)
    3. Then getting the body of the above, then adding dynamic child to the body and setting the body.
    4. So, child component(dynamic) needs to be inside the body of the parent component to be rendered in the view.

    Also remember, you are attaching the dynamically created component to the body of the <div aura:id="divDynamicChild"></div> not to the actualy body of the component <c:testFindDynamic_Parent>.

    Hope this helps.

     

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos