jQuery infinite loop w/ tablesorter
<p>Got myself in a funny situation: page has three tables. Using sortEnd, any time you sort one table, it sorts the other three. However, since I bound sortEnd to the function that does the sorting, you get a infinite loop of sorting/resorting. It looks like:</p>

<pre><code>$("table.tablesorter").tablesorter({widgets: ['zebra']}).bind("sortEnd", function() {
    $(this).find("th.headerSortDown,.headerSortUp").each(function(i) {
        index = $(this).attr("cellIndex");
        order = ($(this).is(".headerSortDown")) ? 1 : 0;
        $("table.tablesorter").tablesorter({sortList: [[index,order]]});
    });
});
</code></pre>

<p>Any tips on how to clean this up?</p>

<p><strong>Based on feedback below from <a href="http://stackoverflow.com/users/13249/nick-craver">Nick Craver</a>, the following code seems to work well:</strong></p>

<pre><code>$("table.tablesorter").tablesorter({widgets: ['zebra']}).bind("sortEnd", function() {
    var current = $(this);
    if (current.data("sorting")) {
        current.data("sorting", false);
        return false;
    }
    $(this).find("th.headerSortDown,.headerSortUp").each(function(i) {
        index = $(this).attr("cellIndex");
        order = ($(this).is(".headerSortDown")) ? 1 : 0;
        $("table.tablesorter").not(current).data("sorting", true).trigger("sorton", [[[index,order]]]);
    });
});
</code></pre>
