TableSorterfilter和滚动器小部件更新
我正在尝试将TableSorter与Widgets Scroller和Filters一起使用,它们非常完美,
$("table").tablesorter({ theme: 'blue', widgets: ["zebra", "filter", "scroller" ] });
但是,我的表开始为null或空,在我输入数据后,所以我要使用Update。
$("table").trigger("updateAll")
有我的问题,我不能同时做Scroller和Filter工作,只是一个或另一个。
有人能帮我吗?
(对不起,如果我的英语不好)
示例: http : //jsfiddle.net/s4ACj/5/
有两个问题。
- filter小部件不会在空表上初始化。
- 滚动小部件需要修复很多错误(我没时间做)
- 包括在初始化时不存在的过滤行。
- 更新表时完全删除滚动窗口小部件
- 等等
要解决此问题,请尝试将附加代码更改为此( 更新演示 ):
$("#append").click(function () { // add some html var html = "Aaron Johnson Sr Atlanta GA ", // 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; });
我会尝试修补,修复错误,并在有空的时候完全重写滚动小部件。