问题:使用jquery插件tablesorter进行表排序和分页
我有一个有 100 行的表,它也有分页。每页显示10条记录。我正在使用 jquery 插件 tablesorter 和 pager。排序和分页就像一个魅力。现在我想做的是当我单击每个表格单元格时显示一个 div。当我加载表格的第一页(即:10 条记录)时,它工作正常。但是当我对其进行排序或使用分页转到任何其他页面时,它会停止工作。弹出窗口根本不出现。我也刚刚尝试过警报。即使这样也行不通。然后我发现如果我注释掉 $(this).trigger("appendCache") 弹出窗口就可以正常工作。但我的表显示所有行。分页是一个折腾。有人可以帮我解决这个问题吗?
非常感谢, 拉奇
I have a table which has 100 rows which also has pagination. each page shows up 10 records. I am using jquery plugins tablesorter and pager. Sorting and pagination work like a charm. Now what I am trying to do is to show up a div when i click on each table cell. when i load the 1st page of the table (i.e: 10 records) it works fine. but when I either sort it or go to any other page using the pagination it stops working. the popup does not come up at all. I also just tried with an alert. Even that does not work. I then figured out that if I comment out $(this).trigger("appendCache") popup works all fine. but my table displays all the rows. Pagination goes for a toss. Can someone please help me on this?
Many thanks,
Racky
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能需要使用
.live()
分配 show-the-div 逻辑,这会将行为附加到动态添加到页面的对象(例如由于分页而出现的新表行) )。所以像这样:
You probably need to assign your show-the-div logic using
.live()
, which will attach the behavior to objects that are added dynamically to the page (like new table rows appearing as a result of pagination).So something like this: