我正在使用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列。如何在最后一栏中禁用排序?
答案 0 :(得分: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;
});
答案 1 :(得分:0)
我正在使用它并且它有效:
// Disable sorting in 5th column
$("table thead th:eq(4)").data("sorter", false);