我正在使用Mottie的jQuery插件https://mottie.github.io/tablesorter/并且已经看到了使用外部链路重置滤波器的能力。我在排序方面也看到过同样的情况。但是,我希望能够重置过滤器和恢复默认排序。
这就是我所拥有的,它不适用于排序,但至少可以重置过滤器。
HTML:<a href="#" id="reset-link">reset</a>
JavaScript:
$('#reset-link').click(function(){
$('#mytable').trigger('sortRestart').trigger('filterReset');
return false;
});
反转触发器(演示)的顺序
$(function() {
var $table = $('#mytable');
$('#reset-link').click(function() {
$table.trigger('filterReset').trigger('sortReset');
return false;
});
$table.tablesorter({
theme: 'blue',
sortList: [[0, 0], [1, 0], [2, 0]],
widgets: ['filter', 'zebra']
});
});