2013-06-24 3 views
0

Я использую jquery-tablesorter так:Отключить tablesorter в одном столбце таблицы в 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 колонок в моей таблице. Как отключить сортировку в последнем столбце?

+1

читать документы http://tablesorter.com/docs/example-options-headers.html – naveen

ответ

0

Я использую это и она работает:

// Disable sorting in 5th column 
$("table thead th:eq(4)").data("sorter", false); 
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; 

}); 
+0

SyntaxError: отсутствует} после списка свойств [Break On This Error] \t Сортировщик: false;} /list_session/(строка 56, col 32) – pynovice

+0

@ user2032220 Я только что отредактировал ... еще раз проверьте. Я раньше пропустил '}'. – stackErr

+0

У меня такая же ошибка. – pynovice