0

我是这样使用jquery-tablesorter的:

$(document).ready(function() { 
    $("table").tablesorter(); 
        // 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; 

});

我的表中共有 5 列。如何禁用最后一列的排序?

4

2 回答 2

2
$(document).ready(function() { 
    $("table").tablesorter({
        headers:{
            4: { //last column
                   sorter: false;
            }
        }
    });
        // 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; 

});
于 2013-06-24T05:59:24.350 回答
0

我正在使用它并且它有效:

// Disable sorting in 5th column 
$("table thead th:eq(4)").data("sorter", false);
于 2013-09-03T21:50:10.160 回答