我有以下表排序器配置:
$(function(){
$table = $('#table')
.tablesorter({
theme: 'blue',
widthFixed: true,
headerTemplate: '{content} {icon}',
widgets: ['zebra','filter'],
widgetOptions: {
zebra: ["even", "odd"],
// filter_anyMatch replaced! Instead use the filter_external option
// Set to use a jQuery selector (or jQuery object) pointing to the
// external filter (column specific or any match)
filter_external : '.search',
// add a default type search to the first name column
filter_defaultFilter: { 1 : '~{query}' },
// include column filters
filter_columnFilters: true,
filter_placeholder: { search : 'Искать...' },
filter_saveFilters : true,
filter_reset: '.reset'
}
})
// needed for pager plugin to know when to calculate filtered rows/pages
.addClass('hasFilters')
.tablesorterPager({
container: $(".table-pager"),
output: '{page} of {filteredPages} ({filteredRows})',
size: 5
});
});
看起来是这样:
我有外部 javascript,它可以更改表 DOM 树。但分页不更新。如何实现刷新分页?
最佳答案
尝试调用以下命令(在表更改后):
$("#table").trigger("update");
关于javascript - 如果我从外部脚本更改表,表排序器分页不会更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29568120/