我有动态后点击搜索按钮如下生成表:排序的所有列标题
puts "<table class=\"resultsTable\">"
puts "<tr><th colspan=\"10\" class=\"head\">Search Results</th></tr>"
puts "<tr>"
puts "<th></th>"
puts "<th>App</th>"
puts "<th>Name</th>"
puts "<th>Region</th>"
puts "<th>Market</th>"
puts "<th>Language</th>"
puts "<th>Function</th>"
puts "<th>LOB</th>"
puts "<th>Term</th>"
puts "<th>Call</th>"
puts "</tr>"
puts "<tr>"
puts "<td id=\"$cellID\">"
puts "<img src=\"images/magnifier.gif\" style=\"cursor:pointer\" onclick=\"showRouting({'spec':'${specific}', 'id':'${mkt_id}', 'name':'${mkt_name}', 'xfer':'${xfertype}', 'cell':'${cellID}'})\"</img>"
puts "</td>"
puts "<td>$level</td>"
puts "<td>$name</td>"
puts "<td>$reg_name</td>"
puts "<td>$link</td>"
puts "<td>$lang</td>"
puts "<td>$func</td>"
puts "<td>$lob</td>"
puts "<td>$term</td>"
puts "<td>$call</td>"
puts "</tr>"
我能有某种排序启用,这样我可以通过每列进行排序(由应用程式,姓名等)?我看过某种jQuery表格分拣机和其他东西,但是我无法用我的代码做到这一点。有人能告诉我如何去做这件事吗?
[0,0] [1,0]是什么意思?我将如何修改我的代码,因此?:
$(document).ready(function()
{
$("#myTable").tablesorter({sortList: [[0,0], [1,0]]});
}
);
你必须使用jQuery或什么的。 Twitter Bootstrap内置了表格排序功能。我会建议检查一下。 –
正如baudday所说..真的没有办法使用jQuery/JavaScript对表进行排序。 –