问题是下面的函数(在 JQuery 中,pager-custom-controls.js)应该触发 onclick 事件,但由于我仍然不知道的任何原因而没有被触发。
// pager-control setup
$pager.on('click', options.currentPage, function() {
focusOnPager = true;
var $el = $(this);
$el
.addClass(options.currentClass)
.siblings()
.removeClass(options.currentClass);
$table.trigger('pageSet', $el.attr('data-page'));
return false;
});
作为一种解决方法,我在 (a) 标记中添加了一个自定义 onclick 函数,并将上面的代码添加到我的自定义 onclick 函数中。
例子:
link : '<a href="#" onclick="({page});">{page}</a>',
function onclick(page) {
var $el = $('#tableID').find('a[data-page]="' + page + '"');
$el
.addClass('current')
.siblings()
.removeClass('current');
$('#tableID').trigger('pageSet', $el.attr('data-page'));
}