Can jTemplates and tablesorter be used together?

Can jTemplates and tablesorter be used together?

Can tablesorter be applied to a table that was generated using jTemplates? I'm currently getting "TypeError: parsers[i] is undefined" when clicking the "Apply tablesorter" button only after the table is fully generated as shown in the following:

  1. <input type="button" name="btnApply" value="Apply tablesorter" onclick="activate()"/>

  2. <div id="dvTest">
  3. loading...

  4. </div>



  5. <script type="text/javascript">

  6. $(document).ready(function() {

  7.   $.getJSON('clip_info.json', function(msg) {

  8.     $('#dvTest').setTemplateURL('http://localhost/test.tpl');

  9.     $('#dvTest').processTemplate(msg);

  10.   });

  11. });



  12. function activate() {

  13.   try {

  14.     $("#tblTest").tablesorter( {sortList: [[1,0]], debug: true} );

  15.   } catch (e) {

  16.     alert(e);

  17.   }

  18. }



  19. </script>

I'm using a button for now to avoid any timing issues, but ideally I could apply tablesorter automatically using some event.

Thanks!
Gary