提取过滤后的表格数据 [英] Extracting filtered table data

查看:73
本文介绍了提取过滤后的表格数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有可能从使用JQuery tableSorter插件/小部件过滤的表中提取过滤的数据.

I was wondering if it is possible to extract the filtered data from a table which has been filtered using the JQuery tableSorter plugin/widget.

我显示了一个大表,然后使用普通的表排序器功能对其进行过滤/排序-但是我想做的是能够获取这个较小的表并从中导出一些数据

I have a large table shown, and I then filter/sort it using the normal tablesorter functionality - but what I would like to do is be able to take this smaller table and export some data from it

这是成员列表-因此,我希望能够从过滤的(例如,超过一定年龄的)数据中导出数据(例如,电子邮件地址),这样我就可以向这些选定的人发送电子邮件,而无需手动输入他们等等.

it's a list of members - so I want to be able to export data (eg email addresses) from the filtered (eg all over a certain age) data so I can then send emails to these select people without having to manually type them etc.

这容易做到吗?我不介意我是否必须自己写点东西,如果有人可以向我指出从哪里开始的正确方向等?

Is this easy to do? I don't mind if I have to write something myself if someone can point me in the right direction on where to start etc?

感谢您提供的任何帮助, 克里斯

Thanks for any help you can give, Chris

推荐答案

您需要做的就是找到可见的表格单元并保存其数据.

All you would need to do is find the visible table cells and save their data.

我不确定您希望如何导出数据,因此我在演示:

I wasn't sure how you wanted the data to be exported, so I opted for csv in this demo:

$('.export').on('click', function(){
    var csv = [];
    // find only visible rows; we're ignoring filtered/hidden rows
    $('table').find('tbody tr:visible').find('td').each(function(){
        csv.push( $(this).text() );
    });
    // do what you want with the csv data here
    $('textarea').val( csv.join(',') )
});

这篇关于提取过滤后的表格数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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