| CITY | PROJECT | HOURS | TASK |
|---|---|---|---|
| Sample footer | |||
| Roma | Army | 152.0 | At justo est sed |
| Arts | 341.0 | et rebum dolor diam | |
| Roma Total: | 493.0 | ||
| Neapolis | Arts | 991.0 | elitr justo amet sadipscing |
| Neapolis Total: | 991.0 | ||
| Roma | Gladiators | 154.0 | nonumy invidunt sed ea |
| Roma Total: | 154.0 | ||
| Olympia | Gladiators | 181.0 | diam magna no rebum |
| Olympia Total: | 181.0 | ||
| Roma | Gladiators | 370.0 | clita no duo nonumy |
| Roma Total: | 370.0 | ||
| Olympia | Gladiators | 967.0 | amet Lorem dolor ut |
| Taxes | 63.0 | et eos et et | |
| 189.0 | justo et dolores diam | ||
| Olympia Total: | 1219.0 | ||
| Neapolis | Taxes | 228.0 | ipsum At amet elitr |
| Neapolis Total: | 228.0 | ||
| Grand Total: | 3636.0 | ||
The purpose of this example is two-fold:
Why would one want to do this? When typical business users are presented with the displaytag export facility, they usually expect the exported Excel or PDF to look just like the HTML in their browser; they expect a WYSIWYG rendering. Yes, even when exporting to Excel, users tend to expect the same look, feel, and structure of the rendered HTML, instead of raw data.
(Note: the model state in this example changes with every view request, such that the data shown will change with every request, but the report's structure remains the same in all formats.)
What this table shows: You have a List who's objects are sorted and grouped by column A, column B and column C, so instead of repeating columns A, B over and over again, it does a grouping of those columns, and only shows data in those columns when it changes. Think of reports... We use the this display tag as a key part of our reporting framework.
Grouping is straight-forward, simply make sure that your list that you are providing is sorted appropriately, then indicate the grouping order via the group attribute of the column tags.