I am trying to sort a table but I am calling the table from a function and it seems that the table.js which is using this js http://www.techjive.net/wp-content/uploads/2009/02/jquerysortpage.js
I thought I would try to call that js file when the function gets called, but that did not work. so I included it in the index.php page to hopefully get it to work.
But when the function runs, it seems that it does not like that the table was not called from the very beginning of the
$("#menuarea").html('<table class="sortable paginated"><thead><tr><th class="sort-alpha"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Column 1</th></tr></thead><tbody><tr><td>Field 1</td></tr><tr><td>Field 3</td></tr><tr><td>Field 2</td></tr></tbody></table>');
The plug-in you're using is hard-coded to apply the sortable functions at document ready time. You've got two options:
initfunction instead of (or in addition to) using document.ready and call it accordingly. Really, that would be a better architecture, but you may not want to start hacking away on the library, particularly if it's being used elsewhere on your site.
Hope that helps.