[英]in jQuery DataTables 1.9, how do I sort by a colspanned header?
我將數據表1.9應用於這種形式的表:
<table>
<thead>
<tr>
<th rowspan=2>Player</th>
<th colspan=2>Overall</th>
<th colspan=2>Technique</th>
<th colspan=2>Style</th>
</tr><tr>
<th>Rank</th><th>Score</th> <!-- for overall -->
<th>Rank</th><th>Score</th> <!-- for technique -->
<th>Rank</th><th>Score</th> <!-- for style -->
</tr>
</thead><tbody>
<tr>
<td>Player 2</td><td>1</td><td>93</td><td>2</td><td>87</td><td>1</td><td>99</td>
<tr></tr>
<td>Player 3</td><td>2</td><td>89</td><td>1</td><td>94</td><td>3</td><td>86</td>
<tr></tr>
<td>Player 1</td><td>3</td><td>87</td><td>3</td><td>85</td><td>2</td><td>89</td>
</tr>
</tbody>
</table>
這樣看可能更容易理解:
┌──────────┬──────────────┬──────────────┬──────────────┐
│ │ Overall │ Technique │ Style │
│ Player ├──────┬───────┼──────┬───────┼──────┬───────┤
│ │ Rank │ Score │ Rank │ Score │ Rank │ Score │
├──────────┼──────┼───────┼──────┼───────┼──────┼───────┤
│ Player 2 │ 1 │ 93 │ 2 │ 87 │ 1 │ 99 │
├──────────┼──────┼───────┼──────┼───────┼──────┼───────┤
│ Player 3 │ 2 │ 89 │ 1 │ 94 │ 3 │ 86 │
├──────────┼──────┼───────┼──────┼───────┼──────┼───────┤
│ Player 1 │ 3 │ 87 │ 3 │ 85 │ 2 │ 89 │
└──────────┴──────┴───────┴──────┴───────┴──────┴───────┘
由於每個類別中的每個等級恰好對應於同一類別中的一個分數,因此我想按類別(標題的第一行)而不是各個列(標題的下一行)對該表進行排序。
如何使用dataTables 1.9按colspanned標頭排序?
不幸的是,dataTables不支持此功能。 您可以在以下文檔中找到與該功能最接近的功能:
http://datatables.net/release-datatables/examples/advanced_init/row_grouping.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.