2011-10-20 110 views
0

我想能够通过ajax(表格内容生成的表单xml)对javascript每1秒生成的表进行排序以显示自动状态。jQuery Tablesorter不能与ajax一起工作

我无法让jQuery tablesorter工作。

我每次更新时(每1秒)都会调用它。它似乎在运行,并没有在Firefox的控制台中的错误。表正常渲染(和更新)

//imports in head tag 
<script type="text/javascript" src="./support/jquery-1.6.4.js"></script> 
<script type="text/javascript" src="./support/jquery.tablesorter/jquery.tablesorter.js"></script> 

updateTable(newXML); //here the table is generated and set to innerhtml of a div tag. 
$("table").tablesorter({sortList:[[0,1],[1,1]]}); 

Essentialy,我期望我的前2列排序降序,但他们不是。

这是我的表格标记,并且在此之后我没有在我的html中看到任何错误。

"<table id='mytable' width=650 class=\"tablesorter\"><tr id='headRow'>" + 

回答

2

根据http://tablesorter.com/docs/

的tablesorter是一个jQuery插件用于打开一个标准的HTML表 THEAD和TBODY标签为排序表,而页面刷新。

我认为你需要<thead><tbody>