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:
- <input type="button" name="btnApply" value="Apply tablesorter" onclick="activate()"/>
- <div id="dvTest">
- loading...
- </div>
- <script type="text/javascript">
- $(document).ready(function() {
- $.getJSON('clip_info.json', function(msg) {
- $('#dvTest').setTemplateURL('http://localhost/test.tpl');
- $('#dvTest').processTemplate(msg);
- });
- });
- function activate() {
- try {
- $("#tblTest").tablesorter( {sortList: [[1,0]], debug: true} );
- } catch (e) {
- alert(e);
- }
- }
- </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