Search code examples
htmljspdisplaytag

display:table, add another thead over column thead


I'm using a display:table to view some report data on a jsp page. I want to use it to exploit the csv/excel export of display table tag. I need to add over the columns header with column name another header, that connect logically the column under it. This is an example:

           +--------------------------------------------+
           |            File               ||   Record  |
           +--------------------------------------------+
+-------------------------------------------------------+
| Sort id ||Col1  ||  col2  || ...  || Coln||col1||coln |
+------------------------------------+------------------+

I tried to use a display:caption with the following code as first object into display table node:

<display:caption>
    <tr class="header">
        <th style="background: white" colspan="1"></th>
        <th class="header" colspan="8">File</th>
        <th class="header" colspan="1">Record</th>
    </tr>   
</display:caption>

It add the column, but under the column name thead :( :

+-------------------------------------------------------+
| Sort id  |Col1  ||  col2  || ...   | Coln||col1||coln |
+------------------------------------+------------------+
           +--------------------------------------------+
           |            File               ||   Record  |
           +--------------------------------------------+

Somebody know if is possible to inject into thead automatically generated by display table tag html code to insert a thead over, or insert in some other way a row over the columns row name header?


Solution

  • I find a solution. Adding in display caption the header that i want enclosed into thead node, it add over column display thead:

    <display:caption>
      **<thead>**    
        <tr class="header">
            <th style="background: white" colspan="1"></th>
            <th class="header" colspan="8">File</th>
            <th class="header" colspan="1">Record</th>
        </tr>
      **</thead>**
    </display:caption>
    

    I do not love this solution, but it works!