gpt4 book ai didi

jquery - 具有两个标题行的表排序器

转载 作者:行者123 更新时间:2023-12-03 22:25:20 26 4
gpt4 key购买 nike

我正在使用tablesorter jquery plugin我的表格标题中有两行。有什么方法可以在我的表上启用排序吗?它应该能够按第二个标题行排序,第一个标题行只是按日期对相关数据进行分组。如果使用此插件不可能做到这一点,也许有人有解决方法的建议?

这是我的表格标记的示例

<table>
<thead>
<tr>
<th colspan="3">January</th>
<th colspan="3">February</th>
<th colspan="3">March</th>
</tr>
<tr>
<!-- January -->
<th>Metric 1</th>
<th>Metric 2</th>
<th>Metric 3</th>
<!-- February -->
<th>Metric 1</th>
<th>Metric 2</th>
<th>Metric 3</th>
<!-- March -->
<th>Metric 1</th>
<th>Metric 2</th>
<th>Metric 3</th>
</tr>
</thead>
<tbody>
<tr>
<!-- January -->
<td>Value 1</td>
<td>Value 2</td>
<td>Value 3</td>
<!-- February -->
<td>Value 1</td>
<td>Value 2</td>
<td>Value 3</td>
<!-- March -->
<td>Value 1</td>
<td>Value 2</td>
<td>Value 3</td>
</tr>
<tr>...</tr>
<tr>...</tr>
<!-- etc -->
</tbody>
<table>

最佳答案

您所要做的就是尝试;)

http://jsfiddle.net/Mottie/4mVfu/402/

如果您希望禁用顶行,请向这些标题单元格添加 sorter-false 类:

<tr>
<th class="sorter-false" colspan="3">January</th>
<th class="sorter-false" colspan="3">February</th>
<th class="sorter-false" colspan="3">March</th>
</tr>

http://jsfiddle.net/Mottie/4mVfu/403/

关于jquery - 具有两个标题行的表排序器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16823951/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com