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

查看:140
本文介绍了需要有关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');

因此,我尝试解除寻呼机click方法的绑定并进行触发器更新,但这似乎不起作用.然后,我尝试在上述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天全站免登陆