问题:使用jquery插件tablesorter进行表排序和分页

发布于 2024-09-05 07:11:54 字数 306 浏览 3 评论 0原文

我有一个有 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

素染倾城色 2024-09-12 07:11:54

您可能需要使用 .live() 分配 show-the-div 逻辑,这会将行为附加到动态添加到页面的对象(例如由于分页而出现的新表行) )。

所以像这样:

$(document).ready( function(){
    $('table#your_table td').live('click', function(){
        // your popup code
    });
});

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:

$(document).ready( function(){
    $('table#your_table td').live('click', function(){
        // your popup code
    });
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文