我有动态表,我使用表分类器寻呼机运行良好,但是当我尝试过滤某些列时,它只返回到第0页,没有任何反应。在某个地方,我尝试通过点击th和其他奇怪的事情对它们进行排序是当我输入表格分类器上的输入框调试模式时说好了。
var $table = $(".track-grid table.tablesorter");
var pagesize = $('.pagesize').val();
$table.tablesorter({
widthFixed: true,
cssChildRow: 'infoRow',
widgets: ['filter'],
debug: true,
widgetOptions: {
filter_hideFilters: true,
// 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_ignoreCase:false
}
});
$table.on('filterInit', function () {
$table.tablesorterPager({
container: $(".pager"),
ajaxUrl: `track/getEvents?page={page}&size={size}&totalCount=` + totalCount,
customAjaxUrl: function (table, url) {
return url;
},
ajaxProcessing: function (data) {
$('.tablesorter tbody').html(data.result.eventsHtml);
$('#trackOverlay').hide();
return [parseInt(data.result.totalEventsCount)];
},
page: 0,
processAjaxOnInit: true,
output: '{startRow} - {endRow} / {filteredRows} ({totalRows})',
updateArrows: true,
fixedHeight: false,
removeRows: false,
savePages: false,
cssNext: '.next', // next page arrow
cssPrev: '.prev', // previous page arrow
cssFirst: '.first', // go to first page arrow
cssLast: '.last', // go to last page arrow
cssGoto: '.gotoPage', // page select dropdown - select dropdown that set the "page" option
cssPageDisplay: '.pagedisplay', // location of where the "output" is displayed
cssPageSize: '.pagesize', // page size selector - select dropdown that sets the "size" option
cssDisabled: 'disabled', // Note there is no period "." in front of this class name
cssErrorRow: 'tablesorter-errorRow' // error information row
});
});
答案 0 :(得分:0)
ajaxUrl
选项需要包含过滤器值。如果您查看documentation中的示例,您会看到:
ajaxUrl: "http://mydatabase.com?page={page}&size={size}&{sortList:col}&{filterList:fcol}",
{filterList:fcol}
将过滤器添加到服务器请求中。
如果内置实施不适合您,请使用customAjaxUrl
callback修改ajax网址。