I hava page in AEM that has a fixed component B and can have one or more components A. The value (multifield paths) of components A (@ValueMapValue) are then used in the logic of component B.
Components A and Component B are not nested components. They are separate components with their own dialog and values. Component B has to iterate through all the components A that are configured on the page and use the values from components A to build its business logic. What would be a suggested way to solve this?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @anasustic
You can get the
Hope it helps!
Thanks,
Kiran Vedantam.
@anasustic you can make use of querybuilder in sling model of component B to get no of components of type A present on the currentPage.
path=/content/<project>
1_property=sling:resourceType
1_property.value=<ComponentA's resouceType>
p.limit=-1
Using that result set you can do whatever you want based on your business logic.
Hope this helps,
Krishna
Hi @krishna_sai
thanks for your answer. How can I do that programmatically in a model?
Views
Replies
Total Likes
Hello @anasustic
Option-1: Your usecase is very similar to a Accordian or Tabs component, where you could limit what components can be added.
Then the resourceType of component A itself can render it.
Option-2: Use nested Sling Models. Example: https://levelup.gitconnected.com/aem-how-to-use-nested-multifields-in-your-components-using-a-sling-...
Thank you @aanchal-sikka
My use case is not exaclty the Accordion or Tab usecase while my Component A und Component B are separate components. They are not nested. They are just allowed on the same page and Component B has to iterate through all the components A that are configured on a page to use these value in its business logic.
Hi @anasustic
You can get the
Hope it helps!
Thanks,
Kiran Vedantam.
Views
Likes
Replies