Accessing the whole table when using the tablesorter and tablesorterPager jQuery plugin

China☆狼群 提交于 2019-12-11 07:39:37

问题


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

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( 

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


回答1:


To answer my own question:

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);
});


来源:https://stackoverflow.com/questions/5819415/accessing-the-whole-table-when-using-the-tablesorter-and-tablesorterpager-jquery

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!