I am currently attempting to turn a dynamically created table into a .tablesorter object. When I actually apply $('table').tablesorter, everything works fine (even in debug mode, it properly detects the number of rows and parser for each column).
However, when actually clicking on one of the headers, I get a "Uncaught TypeError: Cannot read property 'type' of undefined." I've traced this back through the tablesorter code, and it turns out that there is an array within the tablesorter code called sortList. Sort list contains two numbers, the first being the number of column that is being sorted by, the second whether the sort is ascending or descending. For whatever reason, the first number always comes up as "undefined" within my code. If I manually set sortList[0][0] (it's actually a 1d matrix) to be some number, the sorting works perfectly on that column.
I have explicitly taken the generated html out of the browser, pasted it into a new document, and the sorting works fine on that version. As a result I'm suspicious that the error comes from the fact that the entire table (the entire document in fact) is created dynamically by javascript.
I've spent days on this now and am totally at wits end. It seems like this guy had a similar problem, but it went unresolved: How to call jquery table sorter on a table which is getting loaded dynamically