title: Tablesorter - activating a setFilter
body: <p>Use case: csv file to be loaded into a html table which can then be filtered using arguments passed via the url (eg www.example.com?user=joe -- in this case joe is the filter).</p>
  
  <p>I combined these two stackoverflow questions and answers <a href="https://stackoverflow.com/questions/17656696/jquery-tablesorter-dynamically-load-csv">csvtotable</a> and <a href="https://stackoverflow.com/questions/16649475/pre-filter-in-tablesorter">adding a filter</a> but all that happens is the url argument appears in the column's filter box but is not applied - you need to press enter in the filter box for it take effect.  I want it to be applied without user involvement.</p>
  
  <p>I have installed all the js files from <a href="https://github.com/Mottie/tablesorter" rel="nofollow noreferrer">here</a> so hopefully they are compatible.</p>
  
  <p>Here is my pattern matched code.  Any ideas, hints or suggestions?  Thanks</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;head&gt;
  
  &lt;meta http-equiv="refresh" content="60" &gt;
  
  &lt;/head&gt;
  
  &lt;script src="/js/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="/js/jquery.csvToTable.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="/js/jquery.tablesorter.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="/js/jquery.tablesorter.widgets.js" type="text/javascript"&gt;&lt;/script&gt;
  
  &lt;div id="TSVTable2"&gt;&lt;/div&gt;
  
  &lt;script&gt;
  
  //get the agrument from the url
  function getURLParameter(name) {
    return decodeURIComponent((new RegExp('[?|&amp;]' + name + '=' + '([^&amp;;]+?)(&amp;|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null
  }
  
  var username = getURLParameter('user');
  //create the filter for column 7 (zero indexed) using the url arg
  var filters = [];
  filters[7] = username;
  
  //csv to html table
  $('#TSVTable2')
      .CSVToTable('/tmp/set-table_output.tsv', {
          startLine: 0,
          loadingText: 'Loading TSV Data...',
          separator: "\t"
      })
  
      .bind("loadComplete",function() {
          $('#TSVTable2').find('table')
              .tablesorter({
                  widgets: ['filter'],
                  initialized: function (table) {
                          //apply the filter
                          $.tablesorter.setFilters( table, filters, true);
                  }
             })
      });
  
  &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>