1
votes

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

1
maybe I can do something like "$(this).' > tr'" . I just dont know how for the moment. - forX
If you are interested, I have a fork of tablesorter on github which has many improvements. This fix is just one. :) - Mottie

1 Answers

0
votes

You can use :first selector:

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

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