I’m trying to use the tablersorter jQuery plugin (www.tablesorter.com), but I can’t get it to work with a table that’s dynamically populated via YQL from a Google Doc (using Christian Heilmann’s example)
I’m trying to do something like this:
Results
Name Team Position Time Shots six seven eight
Abdoun Algeria Midfielder 16 0 6 0 0
Abe Japan Midfielder 351 0 101 14 0
Abidal France Defender 180 0 91 6 0
I have tablesorter working in this example with a static table:
http://jsfiddle.net/nbierma6/KB5dQ/3/
What am I doing wrong?
You should put
$("#results").tablesorter();inside getJSON callback function, not after it. You are calling tablesorter() on results table before it is created.Edit: You should also change
<td>elements to<th>elements inside<thead>for sorting to work.