2009-12-09 57 views
0

Ok..so某種老鄉幫我如何識別前4行,然後應用CSS來單獨他們..jQuery的 - 實現擴展表排序

$("table").each(function() { 
    $("tr:gt(4)", this).addClass("hidden"); 
}); 

$("table").tablesorter(); 

http://www.tablesorter.com

現在我需要修改附帶擴展名的tablesorter,以便在執行排序時重新計算類分配。所以基本上所有的tr都會刪除它們的類,然後根據新的排序重新計算。

我希望這是有道理的

+0

http://www.tablesorter.com – Chris 2009-12-09 16:19:41

回答

1

你需要修改tablesorter插件,或者你能不能創建自己的插件,可以消除所有的<tr>hidden,然後調用的tablesorter,然後執行$("tr:gt(4)", this).addClass("hidden");

或者,看看http://tablesorter.com/docs/example-triggers.html。它看起來像你可以綁定到sortStart和sortEnd事件,如下所示:

$("table").tablesorter(); 
$("table").bind("sortStart",function() { 
    // remove hidden class here 
}).bind("sortEnd",function() { 
    // add hidden class to certain rows here 
});