Sha*_*eer 13 javascript jquery
你好,我有动态添加行到jquery tablesorter的问题,
我必须在表的开头添加一行,默认情况下tablesorter工作正常但是在添加行之后,表只排序使用前面的行排序我的意思是新行不包括在排序过程中,新行有一些但不是所有字段都空白任何解决方案?
Dav*_*mas 20
tablesorter网站提供了如何执行此操作的详细信息,其中包括:使用Ajax附加表数据.代码转载如下:
$(document).ready(function() {
$("table").tablesorter();
$("#ajax-append").click(function() {
$.get("assets/ajax-content.html", function(html) {
// append the "ajax'd" data to the table body
$("table tbody").append(html);
// let the plugin know that we made a update
// updateAll ensures sorting is updated as well
$("table").trigger("updateAll");
// set sorting column and direction, this will sort on the first and third column
var sorting = [[2, 1], [0, 0]];
// sort on the first column
$("table").trigger("sorton", [sorting]);
});
return false;
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10666 次 |
| 最近记录: |