【问题标题】:How select all rows in table rather than visible rows in Jquery如何选择表中的所有行而不是 Jquery 中的可见行
【发布时间】:2014-05-07 02:46:46
【问题描述】:

我有一个带有分页的 HTML 表格。我需要将表格转换为 csv。以下代码用于获取表格当前页中的所有可见行。

$(el).find('tr').each(function() {
    var tmpRow = [];
    $(this).filter(':visible').find('td').each(function() {
        if ($(this).css('display') != 'none')
            tmpRow[tmpRow.length] = formatData($(this).html());
    });
    row2CSV(tmpRow);
});

那么,无论是否分页,我如何选择表中的所有行,而不是选择当前可见的行。请帮我 !谢谢!

【问题讨论】:

  • 嗯,去掉可见的检查!?

标签: javascript jquery html


【解决方案1】:

试试这个

$(el).find('tr').each(function() {
                var tmpRow = [];
                $(this).find('td').each(function() {
                        tmpRow[tmpRow.length] = formatData($(this).html());
                });
                row2CSV(tmpRow);
            });

移除 :visible 检查和以下条件

$(this).css('display') != 'none'

【讨论】:

    猜你喜欢
    • 2015-08-19
    • 1970-01-01
    • 2012-10-25
    • 2015-09-20
    • 2010-12-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多