jQuery 插件 Tablesorter 2.0 行为怪异
我从下载了 jQuery 插件 Tablesorter 2.0 http://tablesorter.com/jquery.tablesorter.zip 并修改 tablesorter/docs 目录中的 example-pager.html
我编写了额外的翻转效果:
$(function() { $("table") .tablesorter({widthFixed: true, widgets: ['zebra']}) .tablesorterPager({container: $("#pager")}); /** Additional code */ $("tr").mouseover(function () { $(this).addClass('over'); }); $("tr").mouseout(function () { $(this).removeClass('over'); }); $("tr").click(function () { $(this).addClass('marked'); }); $("tr").dblclick(function () { $(this).removeClass('marked'); }); /** Additional code END */ });
当然还修改了 theme/blue/style.css 文件:
/* Additional code */ table.tablesorter tbody tr.odd td { background-color: #D1D1F0; } table.tablesorter tbody tr.even td { background-color: #EFDEDE; } table.tablesorter tbody tr.over td { background-color: #FBCA33; } table.tablesorter tbody tr.marked td { background-color: #FB4133; } /* Additional code END*/
所有这些都工作正常,但是当我转到更多页面(即第 2 3 或 4 页)时 效果消失了!我非常感谢你的帮助
I downloaded the jQuery plugin Tablesorter 2.0 from
http://tablesorter.com/jquery.tablesorter.zip and modified
the example-pager.html which is in tablesorter/docs directory
I wrote additional Rollover effects:
$(function() { $("table") .tablesorter({widthFixed: true, widgets: ['zebra']}) .tablesorterPager({container: $("#pager")}); /** Additional code */ $("tr").mouseover(function () { $(this).addClass('over'); }); $("tr").mouseout(function () { $(this).removeClass('over'); }); $("tr").click(function () { $(this).addClass('marked'); }); $("tr").dblclick(function () { $(this).removeClass('marked'); }); /** Additional code END */ });
And of course modified the themes/blue/style.css file:
/* Additional code */ table.tablesorter tbody tr.odd td { background-color: #D1D1F0; } table.tablesorter tbody tr.even td { background-color: #EFDEDE; } table.tablesorter tbody tr.over td { background-color: #FBCA33; } table.tablesorter tbody tr.marked td { background-color: #FB4133; } /* Additional code END*/
All this works fine BUT when I go to further pages i.e. page 2 3 or 4
the effects are gone! I really appreciate your help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
仅供参考,如果您希望在单击新行时删除先前选定行的“标记”类,您可以执行以下操作:
Just an FYI, if you wish to remove the 'marked' class for the previously selected row when clicking a new row, you can do this:
我解决了这个问题。
我只是在放置翻转和标记效果后调用寻呼机函数,代码如下:
I solved the problem.
I just call the pager function after putting the rollover and marked effects, here is the code:
当对行着色进行排序后,我还遇到了一个问题。我通过指定以下内容解决了这个问题:
$(#your_table).tablesorter({
小部件:[“斑马”],
widgetZebra: {css: ["your_odd_css","your_even_css"]}
});
现在效果很好。没有着色问题。
I also faced one issue when after sorting the row coloring was getting messed. I resolved it via specifying the following:
$(#your_table).tablesorter({
widgets: ["zebra"],
widgetZebra: {css: ["your_odd_css","your_even_css"]}
});
This works good now. No coloring issues.