Search code examples
javaheaderjmesa

jMesa-Java How to add more header rows to a jmesa table


When I dynamically build a jmesa table I get only one header row using the bean properties label. I need one or more additional header rows, where I can set just one or two columns with additional text. Naturally I need also to export the table so I can't use javascript manipulation for html in the jsp result.

What I have:

    <tr class="header" >
            <!-- columns with property  -->
            <td><div onmouseover="this.style.cursor='pointer'" ...> </div></td>
             ...
    </tr>
    </thead>
    <tbody class="tbody" >
            <tr id="idStatistica_row1"  class="odd" ... >
            ...

I need something similar to this:

    <tr class="header" >
            <!-- columns with my free text  -->
            <td><div>HEllo This Is A table</div></td>
            <td><div>NO1</div></td>
    </tr>
    <tr class="header" >
            <!-- columns with property  -->
            <td><div onmouseover="this.style.cursor='pointer'" ...> </div></td>
             ...
    </tr>
    </thead>
    <tbody class="tbody" >
            <tr id="idStatistica_row1"  class="odd" ... >
            ...

Thanks


Solution

  • Is there a specific reason it has to be another table row? For example, do you need this to span multiple columns?

    If you just need to show additional information after a newline, you could use an Editor class to render just the html you want, and include a <br/> or a couple <div> tags inside the header cell.

    It looks like something similar is being done here, in this tutorial about grouped columns