I'm applying datatables 1.9 to a table of this form:
<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>
which might be easier to understand viewed this way:
┌──────────┬──────────────┬──────────────┬──────────────┐
│ │ 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 │
└──────────┴──────┴───────┴──────┴───────┴──────┴───────┘
Since each rank in each category corresponds to exactly one score in the same category, I'd like to sort this table by the categories (the top row of headers), not the individual columns (the bottom row of headers).
How do I sort by colspanned headers using dataTables 1.9?
Unfortunately dataTables does not support this functionality. The closest to this functionality you can get can be found in the following documentation:
http://datatables.net/release-datatables/examples/advanced_init/row_grouping.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.