我正在尝试将 TableSorter 与 Widgets Scroller 和 Filters 一起使用,它们工作完美,
$("table").tablesorter({
theme: 'blue',
widgets: ["zebra", "filter", "scroller" ]
});
但是,我的表开始为空或为空,并且在输入数据后,所以我必须使用更新。
$("table").trigger("updateAll")
我的问题是,我无法同时执行滚动和筛选工作,只能执行其中一项或另一项工作。
有人能帮我吗?
(抱歉,如果我的英语不好)
例子:http://jsfiddle.net/s4ACj/5/
有两个问题。
- 过滤器小部件不会在空表上初始化。
- The scroller widget needs a lot of bug fixes (which I have not had time to do)
- 包括添加过滤器行(如果初始化时不存在)。
- 更新表格时完全删除滚动条小部件
- etc.
为了解决此问题,请尝试将您的附加代码更改为此(更新演示):
$("#append").click(function () {
// add some html
var html = "<tr><td>Aaron</td><td>Johnson Sr</td><td>Atlanta</td><td>GA</td></tr>",
// scroller makes a clone of the table before the original
$table = $('table.update:last');
// append new html to table body
$table.find("tbody").append(html);
// remove scroller widget completely
$table.closest('.tablesorter-scroller').find('.tablesorter-scroller-header').remove();
$table
.unwrap()
.find('.tablesorter-filter-row').removeClass('hideme').end()
.find('thead').show().css('visibility', 'visible');
$table[0].config.isScrolling = false;
// let the plugin know that we made a update, then the plugin will
// automatically sort the table based on the header settings
$("table.update").trigger("update");
return false;
});
当我有时间时,我会尝试修补、修复错误,并可能完全重写滚动条小部件。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)