jQuery tablesorter如何找到sortList对象 [英] jQuery tablesorter how to find sortList object
问题描述
我正在使用jQuery tablesorter插件.我想存储用户如何对页面上的表格进行排序,并在下次页面加载时自动进行排序.为此,我首先需要能够找到存储表排序方式的sortList对象.对于我的一生,我无法弄清楚如何获得它.该文档似乎没有任何内容,我已经尝试了所有我能想到的东西.
I am using the jQuery tablesorter plugin. I am wanting to store how a user has sorted the table on the page and automatically sort that way the next time the page loads. To do this, I first need to be able to find the sortList object that stores how the table is sorted. For the life of me I cannot figure out how to get it. The documentation doesn't seem to have anything on this and I've tried everything I can think of.
推荐答案
您需要将表元素绑定到tablesorter sortEnd
事件.该对象的所有数据都传递到处理程序中.然后,您可以像这样获得当前的排序:
You need to bind your table element to the tablesorter sortEnd
event. All the data for that object is passed in to the handler. You can then get the current sort like so:
var currentSort;
$("#yourtableId").tablesorter({
// initialization
}).bind("sortEnd", function(sorter) {
currentSort = sorter.target.config.sortList;
});
这篇关于jQuery tablesorter如何找到sortList对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!