0

How to fixed table header row in struts2 display table..

Below code is in struts2 display table

<display:table id="approvalList" name="approvalList" pagesize="${PAGESIZE}" export="false"  style="width:934px;align:right;overflow: auto" class="tableHeading" requestURI="approval-list" >
<display:column  title="Reports"  sortable="false" style="width:11%;text-decoration:none;text-align:left;">111</display:column> 
<display:column  title="Project No."  sortable="false" style="width:13%;text-decoration:none;text-align:left;">222</display:column>
<display:column  title="Status"  sortable="false" style="width:16%;text-decoration:none;text-align:left;">333</display:column>   
<display:column  title="Client Name"  sortable="false" style="width:18%;text-decoration:none;text-align:left;">444</display:column>
<display:column  title="Project Name"  sortable="false" style="width:20%;text-decoration:none;text-align:left;">555</display:column>   
<display:column  title="Set No."  sortable="false" style="width:10%;text-decoration:none;text-align:left;">666</display:column>
<display:column  title="Placed Date"  sortable="false" style="width:12%;text-decoration:none;text-align:center;">777</display:column>                </display:table>

Above Code generates the below HTML Code.In that how to fixed table header row.

<table id="approvalList" style="width:934px;align:right;overflow: auto"  class="tableHeading">
    <thead>
    <tr>
        <th>Reports</th>
        <th>Project No.</th>
        <th>Status</th>
        <th>Client Name</th>
        <th>Project Name</th>
        <th>Set No.</th>
        <th>Placed Date</th>
    </tr>
</thead>
<tbody>     
    <tr class="even">
        <td style="width:11%;text-decoration:none;text-align:left;">111</td>
        <td style="width:13%;text-decoration:none;text-align:left;">222</td>
        <td style="width:16%;text-decoration:none;text-align:left;">333</td>
        <td style="width:18%;text-decoration:none;text-align:left;">444</td>
        <td style="width:20%;text-decoration:none;text-align:left;">555</td>
        <td style="width:10%;text-decoration:none;text-align:left;">666</td>
        <td style="width:12%;text-decoration:none;text-align:left;">777</td>
    </tr>
    <tr class="odd">
        <td style="width:11%;text-decoration:none;text-align:left;">111</td>
        <td style="width:13%;text-decoration:none;text-align:left;">222</td>
        <td style="width:16%;text-decoration:none;text-align:left;">333</td>
        <td style="width:18%;text-decoration:none;text-align:left;">444</td>
        <td style="width:20%;text-decoration:none;text-align:left;">555</td>
        <td style="width:10%;text-decoration:none;text-align:left;">666</td>
        <td style="width:12%;text-decoration:none;text-align:left;">777</td>
    </tr>
</tbody>
</table>
Roman C
  • 49,761
  • 33
  • 66
  • 176

1 Answers1

-1

Struts do not give you that but CSS or/and Javascript does.

Try http://www.tablefixedheader.com/ or http://www.imaputz.com/cssStuff/bigFourVersion.html. Everything depends on your requirements.

Another recomendation, avoid inline styles (style attribute) and prefer CSS files and class attribute. They have many advantages, you have only to search it on google.

I hope this help you, any comment will be welcome.

Víctor Herraiz
  • 1,132
  • 1
  • 11
  • 26