Hi All,
I am not able to iterate the below map in sightly.
Map<String, Map<String, Map<ModelObject, List<ModelObject>>>>
I want to parse this map and read all the elements in all objects.
Please help.
Views
Replies
Total Likes
Did you chek this post: Sightly : How to Iterate through Map<String , Map>
//Here an example the shows how it can be done, without java code.
HTL-code:
<div data-sly-use.hashmap="com.adobe.examples.htl.core.hashmap.HashMapExample"
data-sly-list="${hashmap.map.keySet.iterator}">
${item}
<ul data-sly-list.aem="${hashmap.map[item].keySet.iterator}">
<li>${aem} ${hashmap.map[item][aem]}</li>
</ul>
</div>
Another post List of maps in Sightly
Helpx https://helpx.adobe.com/experience-manager/using/htl_movie62.html
~kaututk
Views
Replies
Total Likes
Yes I checked this post and I am able to iterate but I am not able to iterate this below mentioned part of map.
Map<ModelObject, List<ModelObject>>
I am able to get key of above map, but I am not able to get value which is list of model object.
Views
Replies
Total Likes
Kautuk pointed you to valid code to iterate collections. Also see this article for another example:
This HTL component works with a Collection as well. For your example, make sure that you correctly reference the element in the collection using correct HTL syntax.
Views
Replies
Total Likes
Hi Smacdonald,
Kautuk pointed to iterate collections is correct.But in my collection while iterating last map I am able to get key which is object but I am not able to get value corresponding to object key.
I am getting invalid property name error.
Need help with the last map iteration.
Views
Replies
Total Likes
Can you share a sample with code on this?
Views
Replies
Total Likes
Hi Feike,
PFB sightly code.
<ul role="menu" aria-expanded="false" aria-hidden="true" data-sly-list.outer="${modelClass.map[key][keyName].keySet.iterator}"
data-sly-test="${modelClass.map[key][keyName].keySet.iterator}">
<li class="has-sub closed" role="menuitem">
<span>${outer.mainTitle}</span>
<ul role="menu" aria-expanded="false" aria-hidden="true" data-sly-test="${modelClass.map[key][keyName][outer]}">
</ul>
</li>
</ul>
I am getting invalid property name error while testing last iteration <ul> tag.
Views
Replies
Total Likes
Can you share a package with the sample code to replicate this issue and test it out to find the root cause ?
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies