![](/img/trans.png)
[英]Struts2 - How to create a <s:form> for each row in <display:table>
[英]How to fixed table header row in struts2 display table
如何在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>
Struts並沒有為您提供,但是CSS或/和Javascript卻給了您。
嘗試http://www.tablefixedheader.com/或http://www.imaputz.com/cssStuff/bigFourVersion.html 。 一切都取決於您的要求。
另一個建議是,避免使用內聯樣式(樣式屬性),而應使用CSS文件和類屬性。 它們有很多優點,您只需要在google上搜索即可。
希望對您有所幫助,歡迎提出任何意見。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.