2011-10-20 109 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>