The grid tag is used to output each row of a multirow datasource as a cell of an n column grid.
<!-- Begid grid layout, i.e. <table> --> <table> <grid name="datasource" cols="n"> <if \@datasource.col\@ eq 1> <!-- Begin row, i.e. <tr> --> <tr> </if> <!-- Cell layout, i.e. <td>...</td> --> <td> <!-- Cells may be unoccupied at the end. --> <if \@datasource.rownum\@ le \@datasource:rowcount\@> ... \@datasource.variable\@ ... </if> <else> <!-- Placeholder to retain cell formatting --> </else> </td> <if \@datasource.col\@ eq "n"> <!-- End row, i.e. </tr> --> </tr> </if> </grid>
Rows from the data source are output in column-first order. For example, if a datsource has 10 datasources and the grid has 3 columns, the rows from the datasource will appear in the following order:
1 | 5 | 9 |
2 | 6 | 10 |
3 | 7 | |
4 | 8 |
The \@datasource.row\@ variable can be used to band grid rows:
<if \@datasource.col\@ eq 1 and \@datasource.row\@ odd> <tr bgcolor="#eeeeee"> </if> <if \@datasource.col\@ eq 1 and \@datasource.row\@ even> <tr bgcolor="#ffffff"> </if>
Note that this is different from the multiple tag, where the \@datasource.rownum\@ is used for this effect.