【问题标题】:Accessing the whole table when using the tablesorter and tablesorterPager jQuery plugin使用 tablesorter 和 tablesorterPager jQuery 插件时访问整个表
【发布时间】:2011-04-28 13:30:57
【问题描述】:

我正在使用 tablesorter 和 tablesorterpager 插件,我非常喜欢它。 http://tablesorter.com/docs/ http://tablesorter.com/docs/example-pager.html

但是我需要帮助解决我遇到的问题。我为表格中的每一行使用复选框来选择项目。我在表格标题中还有一个“全选”复选框。 在查看寻呼机脚本时,我了解到该插件完全从 DOM 中删除了所有表行,并且只呈现可见行,表的其余部分被缓存。

所以当使用类似这样的代码时:

$("#theTable").find("input[name='cbitems']:not(:disabled)").each(

我只会获取当前可见的元素。不是“隐藏”页面中的元素。

所以我的问题是;有没有办法让缓存表可以访问? 例如:

$("#theTable").cachedTable.find("input[name='cbitems']:not(:disabled)").each( 

我已尝试阅读面向对象的 javascript(或如何称呼它),但没有成功。

【问题讨论】:

    标签: jquery-plugins tablesorter


    【解决方案1】:

    回答我自己的问题:

    缓存表是可访问的,我刚刚省略了 [0] 部分。

    $($("#theTable")[0].config.rowsCopy).each(function() {
        $(this).find("input[name='nodeitems']:not(:disabled)").attr('checked', check);
    });
    

    【讨论】:

    • 感谢您发布您的解决方案。我今天遇到了一个非常相似的问题,这正是我想要的。非常感谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多