Reputation: 51
I am trying to display 2d data in a table the data is in the following way:
[[a,b],[c,d]]
and I want the display like this:
Date |Journal
_________________
a.date |a.journal
b.date |b.journal
c.date |c.journal
d.date |d.journal
here a,b,c,d
are object fetched from controller to GSP page. I want to use <g:each>
to display data in the table. Please help..
Upvotes: 0
Views: 250
Reputation: 51
<g:each var ="pb" in="${pBill}">
<tr>
<td>${pb[0].voucherDate}</td>
<td>(PB)${pb[0].voucherNumber.voucherNumber}</td>
</tr>
<tr>
<td>${pb[1].voucherDate}</td>
<td>(PBR)${pb[1].voucherNumber.voucherNumber}</td>
</g:each>
Upvotes: 0
Reputation: 50285
Either:
Example:
[[a,b],[c,d]].flatten() == [a, b, c, d]
and use one g:each
.
OR
example:
<g:each var="elem" in="${mainList}">
<g:each var="item" in="${elem}">
<!-- Create the tabular structure -->
</g:each>
</g:each>
Upvotes: 1