I need to create multiple instances of the same component in a loop based on how many items are in a list. This was easily accomplished in jsp's but in sightly I am not finding a way to do this. In a jsp I would do a cq:include and if the path had the same name it would append a count on the end. Below is an example of my sightly component but need some advice on how to do this correctly. An example of what would be in the row.columnList would be {6,3,3}
<div data-sly-use.row="com.my.aem.components.view.models.MyRowComponent" data-sly-unwrap> <p data-sly-test="${!row.columns}">Please configure row</p> <div class="row"> <div data-sly-list="${row.columnList}" class="pod-grid container-fluid"> <div class="col-md-${item}"> <div data-sly-resource="${'testcomponent' @ resourceType='my/components/content/pods/testcomponent' }"></div> </div> </div> </div> </div>
Any help would be appreciated
Solved! Go to Solution.
Views
Replies
Total Likes
try this...
with data-sly-test and @ format you can declare a local-var and concatenate Strings.
Views
Replies
Total Likes
try this...
with data-sly-test and @ format you can declare a local-var and concatenate Strings.
Views
Replies
Total Likes
This works awesome! I didn't realize that you could set variables using the data-sly-test. Thanks for the help.
Views
Replies
Total Likes
thanks for the feedback. No JSP anymore please :-)
Views
Replies
Total Likes
Hi,
After including the multiple components of the same type in a loop as suggested the above approach, those components are not reorder-able, is there some config which enables them to reoder like other components, using AEM6.3 with SP1.
Views
Replies
Total Likes