Iterate Multivaluedmap in sightly

Avatar

Avatar

Nithyasri_K

Avatar

Nithyasri_K

Nithyasri_K

23-12-2020

I am trying to iterate a multivaluedmap 

MultiValuedMap<String, Map<String,List<ModelObj>>> through HTL as below. But, I get values upto two levels which are String. Not able to access ModeObj. 

<div data-sly-use.nav="fragmentexamples.core.models.Nav">
<ul data-sly-list.year="${nav.map}">
<div> ${year} </div> ------ First level String gets printed
<ul data-sly-list.type="${year}">
<li>${type} </li> --------Second level String gets printed
${nav.map[year][type]} or ${nav.map[year][type]['modelObjProp']}------- not working
</ul>
</ul>
</div>

 

View Entire Topic

Avatar

Avatar

Nithyasri_K

Avatar

Nithyasri_K

Nithyasri_K

24-12-2020

Hi @Manjunath_K 

 

Thank your for the help. Your solution worked with a slight modification as per my object.

 

<div data-sly-use.nav="fragmentexamples.core.models.Nav">
<ul data-sly-list.year="${nav.map.entrySet}">
<div> ${year.key}</div>
<ul data-sly-list.val="${year.value}">
<ul data-sly-list.type="${val.entrySet}">
<li>${type.key}
<ul data-sly-list.modelList="${type.value}">
<li>{modelList.modelProp}</a></li>
</ul>
</li>
</ul>
</ul>
</ul>
</div>