jQuery tablesorter - loss of functionality after AJAX call

后端 未结 8 991
庸人自扰
庸人自扰 2021-02-14 06:00

I have recently been experimenting with the tablesorter plugin for jQuery. I have successfully got it up and running in once instance, and am very impressed. However, I have tri

8条回答
  •  梦毁少年i
    2021-02-14 06:17

    after ajax call when changed your html content you need to update TableSorter.

    TRY THIS FOR ME WORKING OK

    if you appending html

    $("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]);
    

    and when you add new html instead older

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

提交回复
热议问题