【发布时间】:2017-06-12 20:06:39
【问题描述】:
我正在使用 tablesorter (http://tablesorter.com/docs/) 和它的 AJAX 寻呼机功能。这是我用来初始化插件的代码:
$(".track-grid table.tablesorter")
.tablesorter({
widthFixed: false,
cssChildRow: 'infoRow',
widgets: ['zebra']
})
.tablesorterPager({
container: $(".pager"),
ajaxUrl : 'analyse/getEvents?page={page}&size=10&totalCount='+totalCount,
customAjaxUrl: function(table, url) {
// get current selection & add it to the url
return url += '&filter=' + JSON.stringify(filter);
},
ajaxProcessing: function(data){
$('#tablesorter tbody').html(data.result.eventsHtml);
return [ parseInt(data.result.totalEventsCount) ];
},
page: 0,
processAjaxOnInit: true,
output: '{startRow} to {endRow} ({totalRows})',
updateArrows: true,
fixedHeight: false,
removeRows: 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
});
这一切都很好。事件被初始化(从后端获取),每当我点击更改页面时,都会加载新事件。但是,该页面似乎“记住”了用户上次登录其帐户的时间。例如:如果我第一次打开页面,寻呼机从第 1 页(0)开始,但是如果我切换了几个页面然后重新启动 nodeJS 服务器,重新启动浏览器和一切,每当我重新登录到应用程序时page 仍然是我手动设置的最后一个。如何强制寻呼机始终从第一页开始? (也在页面刷新时)此外,页面大小显示为 25,尽管我在初始化时将其设置为 10。我在哪里出错了?
提前谢谢你!
【问题讨论】:
标签: jquery node.js ajax tablesorter