let tablesorter know table was updated

let tablesorter know table was updated

I have tablesorter installed and working just fine.

Now I want to have the table in question to be dynamically updated, with the script below, which also is working fine.

As it happens, once the table is updated tablesorter no longer works correctly.

The question is, how can I tell tablesorter from within my script that the table was updated so that it will sort the new result set?

I have looked and the post below and updated my function accordingly,  as well as the tablesorter script itself as indicated, but the odd behavior continues.
It adds wrong result set for the updates, loses the ability to toggle between ascending, descending.

dynamically-updating-tablesorter-two-problems

Thanks for your input.

  1. <script>
    $(document).ready(function(){   
    $("#filter").change(function()
    {
        var str = $("#filter").serialize();
     
        alert( str );

         $.ajax({
                url: "filter_trim.php",
                type: "POST",
            dataType:"html",
               data: str,
               success: function(data){
            $("#myTable tbody").html(data); //Replace contents of <tbody> tag













  2.                   $("#myTable").tablesorter();
                            // let the plugin know that we made a update
                            $("#myTable").trigger("update");
                            // set sorting column and direction, this will sort on the first and third
                            var sorting = [[2,1],[0,0]];
                            // sort on the first column
                            $("table").trigger("sorton",[sorting]);
           }
         });
      });
      });
    </script>