jquery tablesorter 动态加载数据时,排序。过滤失效解决方案

解决方案:重置更新:

  $("table").trigger("update"); 

1 官方 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 
            $("table").trigger("update"); 
            // 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; 
    }); 
});

 

posted @ 2019-06-27 14:59  前端邢晋宇  阅读(557)  评论(0编辑  收藏  举报