[英]Dynamically add headers in table datatable
可以在THEAD
使用dataTables處理2行嗎?
<table>
<thead>
## row 1
## row 2
</thead>
<tbody></tbody>
</table>
在第1行中,我需要2個單列和1個具有colspan="3"
:
<tr>
<th></th>
<th></th>
<th colspan="3"></th>
</tr>
在第2行中,我需要5列:
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
但是我有一種情況,我不需要5列,而只需要3列。
可以動態生成嗎?
更新 :我嘗試過: http : //datatables.net/release-datatables/examples/basic_init/complex_header.html
但是沒有很好的例子說明它是如何產生的。
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
<thead>
<tr>
<th rowspan="2">Rendering engine</th>
<th rowspan="2">Browser</th>
<th colspan="3">Details</th>
</tr>
<tr>
<th>Platform(s)</th>
<th>Engine version</th>
<th>CSS grade</th>
</tr>
</thead>
<tfoot>
<tr>
<th rowspan="2">Rendering engine</th>
<th rowspan="2">Browser</th>
<th>Platform(s)</th>
<th>Engine version</th>
<th>CSS grade</th>
</tr>
<tr>
<th colspan="3">Details</th>
</tr>
</tfoot>
(代碼從上面的鏈接中刪除)
關於查看源代碼的一句話:在Firefox中,您可以按ctrl + u查看頁面源代碼。 即使頁面上有大量jQuery動作,該窗口中的源代碼也始終是原始代碼,無需進行DOM修改。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.