Reputation: 12205
I have a def statusMap = HashMap<String, List<MyItem>>()
that gets passed into my gsp page.
In my gsp page I have the following:
<g:each var="myList" in="${statusMap}">
<div id="pending_list" class="onTop">
<g:render template="/list" model="['list':"${myList.value}", 'listSize':"${myList.value.size()}"]" />
</div>
</g:each>
But I can't seem to correctly pass myList.value
and myList.value.size()
into my template. I think my quotes are wrong somehow but I'm not sure.
How can I correctly pass myList.value and myList.value.size() into the list template through the model?
Upvotes: 1
Views: 1230
Reputation: 24776
Since you are using a map your itteration is based on keys within that Map. So the basic syntax looks like this:
<g:each in=${yourCoolMap.entrySet()}" var="entry">
${entry.key} = ${entry.value}
</g:each>
Thus, your code will look something like this:
<g:each var="myList" in="${statusMap.entrySet()}">
<div id="pending_list" class="onTop">
<g:render template="/list" model="['list': myList.value, 'listSize': myList.value.size()]" />
</div>
</g:each>
Upvotes: 1