Hi Team, I was wondering if it's possible to iterate through a list of Maps which contains a list of Pojo. This is because the actual requirement is to display a "categorized" list. i.e:
I was checking some of the past post reading how to iterate over Map but seems like none of the solutions below have worked on.. (I'm thinking if this kind of implementations is valid).
if you have any inputs or guidance in how to accomplish this. I'll be very grateful with you guys
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @Luis_Ochoa
could you please check
<!-- Assuming 'myList' is the List<Map<String, List<Pojo>>> variable available in your context -->
<ul data-sly-list="${myList}">
<!-- Outer loop: Iterating through the List<Map<String, List<Pojo>>> -->
<li>
<!-- Extracting the map from the list item -->
<sly data-sly-test="${item['myMap']}" data-sly-use.myMap="${item['myMap']}">
<p>Map Key: ${item.key}</p>
<!-- Inner loop: Iterating through the Map<String, List<Pojo>> -->
<ul data-sly-list="${myMap}">
<li>
<!-- Extracting the list from the map item -->
<sly data-sly-test="${item['myList']}" data-sly-use.myList="${item['myList']}">
<p>List Key: ${item.key}</p>
<!-- Innermost loop: Iterating through the List<Pojo> -->
<ul data-sly-list="${myList}">
<li>${item.property1}</li>
<li>${item.property2}</li>
<!-- Add more properties as needed -->
</ul>
</sly>
</li>
</ul>
</sly>
</li>
</ul>
Hi @Luis_Ochoa
could you please check
<!-- Assuming 'myList' is the List<Map<String, List<Pojo>>> variable available in your context -->
<ul data-sly-list="${myList}">
<!-- Outer loop: Iterating through the List<Map<String, List<Pojo>>> -->
<li>
<!-- Extracting the map from the list item -->
<sly data-sly-test="${item['myMap']}" data-sly-use.myMap="${item['myMap']}">
<p>Map Key: ${item.key}</p>
<!-- Inner loop: Iterating through the Map<String, List<Pojo>> -->
<ul data-sly-list="${myMap}">
<li>
<!-- Extracting the list from the map item -->
<sly data-sly-test="${item['myList']}" data-sly-use.myList="${item['myList']}">
<p>List Key: ${item.key}</p>
<!-- Innermost loop: Iterating through the List<Pojo> -->
<ul data-sly-list="${myList}">
<li>${item.property1}</li>
<li>${item.property2}</li>
<!-- Add more properties as needed -->
</ul>
</sly>
</li>
</ul>
</sly>
</li>
</ul>
Views
Likes
Replies
Views
Likes
Replies