0

如何在struts2显示表格中固定表格标题行..

下面的代码在struts2显示表中

<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>

上面的代码生成下面的 HTML 代码。关于如何固定表格标题行。

<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>
4

1 回答 1

-1

Struts 不给你,但 CSS 或/和 Javascript 给你。

试试http://www.tablefixedheader.com/http://www.imaputz.com/cssStuff/bigFourVersion.html。一切都取决于您的要求。

另一个建议,避免内联样式(样式属性)并更喜欢 CSS 文件和类属性。它们有很多优点,你只需要在谷歌上搜索它。

我希望这对你有帮助,欢迎任何评论。

于 2013-01-25T17:53:27.480 回答