tablesorter saveSort exception

tablesorter saveSort exception

Hi I have tablesorter working okay on a .aspx page.
 
My table is being created as an HTML stream and is being added to the innerHTML of a div during page load.
 
I am attempting to use the widget to remember sortOrder on page refresh. (saveSort)
 
This causes an error in the widget source. Unable to get property '$table' at the last line below  $table = c.$table

Assuming this is due to the table not existing before the sortwidget is trying to update it, I have attempted to move the location of tablesorter code (3 below) to different locations on the page to no avail.
 
Currently it is right after the div for both tables
 
Any thoughts?
 
Thank you.
 
 
 
  1. </ tbody ></ table ></ div >< script type ="text/javascript"> $( function () {$( '#tablesessions' ).tablesorter();}); </ script >< script type ="text/javascript"> $( function () {$( '#tableconnections' ).tablesorter();}); </ script ></ div ></ div >

  2. ts.addWidget({
     id: 'saveSort',
     priority: 20,
     options: {
      saveSort : true
     },
     init: function(table, thisWidget, c, wo) {
      // run widget format before all other widgets are applied to the table
      thisWidget.format(table, c, wo, true);
     },
     format: function(table, c, wo, init) {
      var stored, time,
       $table = c.$table,
  3. "<script type=""text/javascript"">$(function () {$('#tableconnections').tablesorter({ widgets: [""saveSort""]});});</script>" , _