체크 아웃은 입력 값을 사용하여 열을 정렬 할 수있는 사용자 정의 파서의이 데모 :
Dynamic input value sorting
는 슬프게도,이 파서는 원래 tablesorter에 플러그인에서 작동하지 않습니다, 그러나 그것은에 대한 것입니다 나의 github는 tablesorter의 갈래 버전.
// add parser through the tablesorter addParser method
$.tablesorter.addParser({
id: 'inputs',
is: function(s) {
return false;
},
format: function(s, table, cell, cellIndex) {
var $c = $(cell);
if (!$c.hasClass('updateInput')) {
$c
.addClass('updateInput')
.bind('keyup', function() {
$(table).trigger('updateCell', [cell, false]); // false to prevent resort
});
}
return $c.find('input').val();
},
type: 'text'
});
$(function() {
$('table').tablesorter({
headers: {
3: {
sorter: 'inputs'
}
}
});
});