You need to sign in to do that
Don't have an account?
Issue in dynamically rendering nested components!!
Case:
I am a nested component tree structure by dynamically rendering components. To create component I used below default method (Aura):
$A.createComponent( type, params, callback );
Structure to achive:
parentA.cmp
|----AChildLvL1.cmp
| |------ALvL1SubChild1.cmp
| |------ALvL1SubChild2.cmp
|----BChildLvL2.cmp
| |------BLvL2SubChild1.cmp
| |------BLvL2SubChild2.cmp
In above patern I am dynamically create component AChildLvL1.cmp/BChildLvL2.cmp and based on further condition their child component are being rendered.
Problem:
Component is not able to render dynamically. in below conditions:
1. In lightning add builder view it is not able to render dynamically.
2. Same is being replicating whenever I am pushing same code in my unmanaged package and installing it in different org.
After installing package I'm facing same issue.
Please let me know if anyone is aware of the reason, any help would be appreciated.
Regards-
Himanshu Dangwal
If you are creating a package then call your component with packaging org namespace like namespace: component instead of c: component.
If it works for you then choose my answer as the best answer.
Thanks
Vivek Gupta
All Answers
Greetings to you!
You must empty the body of the previously created component to create another component dynamically.
cmp.set("v.body",[]);
After that you can call the $A.createComponent( type, params, callback );
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com
Thank you for your answer, but this solution is not working.
Let me update my query:
> I am using managed package, with namespace eg: test_
if you are aware then please do let me know.
Regards-
Himanshu Dangwal
If you are creating a package then call your component with packaging org namespace like namespace: component instead of c: component.
If it works for you then choose my answer as the best answer.
Thanks
Vivek Gupta