jQueryのTablesorter - リンクをクリックすることで並べ替え
-
19-09-2019 - |
質問
私は、テーブルをソートするjQueryのTablesorterを使用していますし、すべてが期待どおりに動作します。私は何をしたいのですが、「価格によるソート」の線に沿って何かを言う私のテーブルの上のリンクを追加し、ユーザーは、私が「価格」欄にソートするリンクをクリックしたとき。彼らは再びそれをクリックするとさらに、それが価格に他の方法をソートします。これは可能でしょうか?
ありがとう! Manojさん
解決
から
$(document).ready(function() {
$("table").tablesorter();
$("#trigger-link").click(function() {
// set sorting column and direction, this will sort on the first and third column the column index starts at zero
var sorting = [[0,0],[2,0]];
// sort on the first column
$("table").trigger("sorton",[sorting]);
// return false to stop default link action
return false;
});
});
所属していません StackOverflow