繁体   English   中英

在jQuery DataTables 1.9中,如何按colspanned标头排序?

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM