1

I'm working with jquery.tablesorter plugin. I use sub grid. but the zebra function do this:

 $("tr:visible", table.tBodies[0]).each(function(i) {

but that put function on every child tr. Can you help me to change this line for creating function only on first child of the grid.

<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>

Limit function to first TR ("firstchild")

4

1 回答 1

0

您可以使用:first选择器:

$("tr:visible:first", table.tBodies[0])

$("tr:visible:first-child", table.tBodies[0])
于 2012-10-01T13:23:59.167 回答