使用tablesorter和tablesorterPager jQuery插件时访问整个表 [英] Accessing the whole table when using the tablesorter and tablesorterPager jQuery plugin

查看:226
本文介绍了使用tablesorter和tablesorterPager jQuery插件时访问整个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using the tablesorter and tablesorterpager plugin and I really like it. http://tablesorter.com/docs/ http://tablesorter.com/docs/example-pager.html

但是,我在遇到问题时需要帮助.我在表格中的每一行都使用复选框来选择项目.我在表头中还有一个全选"复选框. 在查看分页脚本时,我了解到该插件会从DOM中完全删除所有表行,而仅呈现可见行,其余的表将被缓存.

However I need help with a problem I have. I use checkboxes for every row in a table for selecting items. I also have a "select all" checkbox in the table header. When looking at the pager script I understand that the plugin completely removes all the table rows from the DOM and only renders the visible rows, the rest of the table is cached.

因此,当使用与此类似的代码时:

So when using code similar to this:

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

我只会得到当前可见的元素.不是隐藏"页面中的元素.

I will only get elements currently visible. Not elements in "hidden" pages.

所以我的问题是;无论如何,使缓存的表可访问? 例如:

So my question is; is there anyway to make the cached table accessible? For example:

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

我尝试阅读面向对象的javascript(或称其为JavaScript),但没有成功.

I have tried reading up on object oriented javascript (or what to call it), but no success.

推荐答案

要回答我自己的问题:

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

The cached table is accesible, I had just left out the [0] part.

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

这篇关于使用tablesorter和tablesorterPager jQuery插件时访问整个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆