Reputation: 167
Can I loop through more than 1 item in g:each tag in grails? I want to simultaneously loop through 2 items of same length and then display the response.
Any help on this is appreciated.
Upvotes: 1
Views: 906
Reputation: 2776
Yes, you can.
You can use status
to know which loop it is and which element to grab.
<g:each in="${firstList}" status="i" var="elem">
<td>${secondList[i].attribute}</td> //you can access 2nd list elements like this
<td>${elem.attribute}</td> //you can access first list elements like this
</g:each>
Upvotes: 3