【发布时间】:2025-12-19 18:50:17
【问题描述】:
我正在使用 jquery.tablesorter 插件。 我使用子网格。但是斑马函数会这样做:
$("tr:visible", table.tBodies[0]).each(function(i) {
但是那把函数放在每个孩子 tr 上。 你能帮我改变这条线,只在网格的第一个孩子上创建函数吗?
<table class="GridA">
<tr class="firstchild"><td></td></tr>
<tr class="expand-child"><td>
<table class="GridB">
<tr><td>
</td>
</tr>
</table>
</td>
</tr>
<tr class="firstchild"><td></td></tr>
<tr class="expand-child"><td>
<table class="GridB">
<tr><td>
</td>
</tr>
</table>
</td>
</tr>
</table>
将函数限制为第一个 TR(“firstchild”)
【问题讨论】:
-
也许我可以做一些类似“$(this).”的事情。 > tr'" 。我只是暂时不知道该怎么做。
-
如果你有兴趣,我在 github 上有一个fork of tablesorter,它有很多改进。这个修复只是一个。 :)
标签: jquery html-table tablesorter