Displaytag, grouping and blank lines

I'm looking for a way to group with a displaytag but with the group name separated from the detail. This is probably not so clear, here is an example:

If I just add the groups to the displaytag table, I get something like:

| group1 | item1 |
|        | item2 |
|        | item3 |
| group2 | item4 |
|        | item5 |

      

I would like something like:

| group1 |       | 
|        | item1 |
|        | item2 |
|        | item3 |
| group2 |       |
|        | item4 |
|        | item5 |

      

I can't find anything in the documentation. Does anyone know if there is work to do? Or will I just go back to plain, handwritten JTSL?

0


source to share


1 answer


Sorry to be 7 months late to the party, but try using a decorator MultilevelTotalTableDecorator

, it generates an empty string at your request, but this is really a side effect of what the decorator is supposed to do. You will have to play with other options to get him to do what you want.



<%
        // you can do this as a scriptlet on the page, but i put it into a taglib...
        org.displaytag.decorator.MultilevelTotalTableDecorator subtotals = new org.displaytag.decorator.MultilevelTotalTableDecorator();
        subtotals.setGrandTotalDescription("&nbsp;");    // optional, defaults to Grand Total
        subtotals.setSubtotalLabel("&nbsp;", null);
        pageContext.getRequest().setAttribute("subtotaler", subtotals);
%>
<display:table name="contacts" id="contactRow" defaultsort="1" defaultorder="ascending" decorator="subtotaler">
    <display:column property="contactType" title="Contact Type" total="true" group="1"/>
    <display:column property="contactDate" format="{0,date,MM/dd/yyyy}" title="Date" />
    <display:column property="contactName" title="Name" />
    <display:column property="contactPhone" title="Phone" />
    <display:column property="contactEmail" title="Email" />
</display:table>

      

+1


source







All Articles