Javascript 使用tablesorter对TR的块进行排序

Javascript 使用tablesorter对TR的块进行排序,javascript,jquery,html-table,tablesorter,Javascript,Jquery,Html Table,Tablesorter,使用TableSorter插件,我需要对多个TR进行排序,这些TR是由多个TR组成的块(子TR的未定义数量)(JSFIDLE中的示例) 阿尔布雷 250 360 5. 35 72 1200 3850 2055 好啊 -平白朗 子数据列2 子数据列3 子数据列4 子数据列5 子数据列6 子数据列7 子数据列8 子数据列9 好啊 -索勒斯 子数据列2 子数据列3 子数据列4 子数据列5 子数据列6 子数据列7 子数据列8 子数据列9 好啊 贝托 3520 6230 321 322 323 500

使用TableSorter插件,我需要对多个TR进行排序,这些TR是由多个TR组成的块(子TR的未定义数量)(JSFIDLE中的示例)


阿尔布雷
250
360
5.
35
72
1200
3850
2055
好啊
-平白朗
子数据列2
子数据列3
子数据列4
子数据列5
子数据列6
子数据列7
子数据列8
子数据列9
好啊
-索勒斯
子数据列2
子数据列3
子数据列4
子数据列5
子数据列6
子数据列7
子数据列8
子数据列9
好啊
贝托
3520
6230
321
322
323
500
780
6542
好啊
-皇室财产
Sub-Data-col2
Sub-Data-col2 3
Sub-Data-col2 4
Sub-Data-col2 5
Sub-Data-col2 6
Sub-Data-col2 7
Sub-Data-col2 8
Sub-Data-col2 9
好啊
-皇家詹姆斯
Sub-Data-col3 2
子数据-col3
Sub-Data-col3 4
Sub-Data-col3 5
Sub-Data-col3 6
Sub-Data-col3 7
Sub-Data-col3 8
Sub-Data-col3 9
好啊
-护林员
Sub-Data-col3 2
子数据-col3
Sub-Data-col3 4
Sub-Data-col3 5
Sub-Data-col3 6
Sub-Data-col3 7
Sub-Data-col3 8
Sub-Data-col3 9
好啊
-安妮女王的复仇
Sub-Data-col3 2
子数据-col3
Sub-Data-col3 4
Sub-Data-col3 5
Sub-Data-col3 6
Sub-Data-col3 7
Sub-Data-col3 8
Sub-Data-col3 9
好啊

当我单击“Col1”时,我只需要对该列每个块的第一行进行排序,与“col2”相同,后者只需对第二列进行排序

我不知道怎么做,你能帮我吗


谢谢

我认为这是一个很好的案例(见)

您需要重新格式化HTML。。。用
colspan
和每个块的第一个
tr
移除
td

  <td colspan='10' class='group-tr'>
    <table class='line'>
      <tr height='26' >
不要忘记包含
小部件SortBody
小部件:

<script src="../js/widgets/widget-sortTbodies.js"></script>

hoooooly-sh***t,我没有看到这个小链接,非常感谢:D
      </tr>
    </table>
  </td>
<tbody>
  <tr class="lineX">...</tr>
  <tr>...</tr>
  <tr>...</tr>
</tbody>
$("#sort").tablesorter({ 
  sortList: [0,0],
  sortMultiSortKey: 'altKey',
  widgets: ['sortTbody'],
  widgetOptions: {
    sortTbody_lockHead: true,
    sortTbody_primaryRow: '.lineX',
    sortTbody_sortRows: true
  }
});
<script src="../js/widgets/widget-sortTbodies.js"></script>