需要 Jquery TableSorter Pager 插件的帮助 [英] Need Help with Jquery TableSorter Pager plugin

查看:26
本文介绍了需要 Jquery TableSorter Pager 插件的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 tablesorter 插件:http://tablesorter.com/docs/ 和 jquery 1.4.2

I am using the tablesorter plugin: http://tablesorter.com/docs/ with jquery 1.4.2

现在我的问题是这个.用户可以动态地将行添加到表中.但这似乎弄乱了分页.像第一次一样,它被添加到行的第一个页面",但如果你要转到第二页然后你又回到第一页.你新的记录不见了.我不知道它去了哪里,但它已经消失了.

Now my problem is this. The user can dynamically add rows to the table. But this seems to mess up the paging. Like first it gets added to the first "page" of rows but if you would go to the second page and you go back to the first page. You newly record is gone. I don't know where it goes but it is just gone.

我试过这样做

$('#pagerid').unbind('click');
 $('#tbl tbody ').append(response.HtmlRow);
 $('#tbl').trigger('update');

所以我尝试取消绑定寻呼机单击方法并进行触发器更新,但这似乎不起作用.然后我尝试在上述 3 行之后添加这一行.

So I tried to unbind the pager click method and do a trigger update but that does not seem to work. I then tried to add this line after the above 3 lines.

$('#tbl').tablesorterPager({ container: $('#pagerid') }); 

但它似乎也无能为力.

http://tablesorter.com/docs/example-pager.html

推荐答案

这是因为 TableSorterPager 存储了表行的缓存数组,然后销毁/重新创建仅显示缓存中有趣"行的表 - 取决于已选择页面.

This is because TableSorterPager stores a cached array of the table rows and then destroys/recreates the table only showing the "interesting" rows from the cache - depending on the page selected.

我之前在工作中遇到过这个问题,除了我在 Pager 和 TableSorter 之上还有 TableSorterFilter 插件.最后我终于让它工作了,但是修改插件代码需要付出很多努力.

I ran into this issue before at work, except I also had the TableSorterFilter plugin on top of Pager and TableSorter. I ended up getting it to work, finally, but it took a lot of effort modifying the plugin code.

如果我要重新开始,我会选择 DataTables.net,它似乎有更丰富的 API做这些类型的事情.事实上,我建议在你发疯之前走这条路!

If I were to start over, I would have just went with DataTables.net which seems to have a richer API for doing these types of things. In fact, I'd suggest going this route before you make yourself insane!

这篇关于需要 Jquery TableSorter Pager 插件的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆