-1

HTMLテーブルにフィルターと並べ替えのオプションが必要です。'tablesorter.js'を試しました。

このモジュールを使用して、テーブルフィールドを並べ替えることができます。しかし、テーブルフィールドを含むドロップダウンリストとフィルターボックスを追加することはできません。

誰かが私を助けることができますか?

4

2 に答える 2

1

これを使ってみてください

これは短いHTMLテーブルです。

また

デモドロップダウンリストを使用して略して

$('table').tablesorter();

$('select').change(function(){
    var column = parseInt($(this).val(), 10),
        direction = 1, // 0 = descending, 1 = ascending
        sort = [[ column, direction ]];
    if (column >= 0) {
        $('table').trigger("sorton", [sort]);
    }
});
于 2012-10-25T12:12:28.613 に答える
0

の列のにclass="filter-select"を追加することにより、テーブル列にドロップダウンリストフィルターを追加できます。

<thead><th>Col 1></th><th class="filter-select">Col2</th></thead>

または、その列にフィルター関数を追加できます。

filter_functions : {

    // Add select menu to 3rd column (column numbers are zero-based).
    // Set the column value to true, and/or add "filter-select" class name to header
    2 : true,
}
于 2013-11-01T00:44:23.030 に答える