数据表 - 是否可以仅下载显示为CSV的数据? [英] Datatables - Is it possible to download only the data that is shown as CSV?

查看:138
本文介绍了数据表 - 是否可以仅下载显示为CSV的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道数据表允许您隐藏列和过滤行。

I know that datatables allow you hide columns and filter rows.

Tabletools允许用户以CSV格式下载表格数据。

Tabletools allow users to be able to download the table data as CSV.

但是,它似乎下载了所有的东西。

However, it seems that it downloads everything.

有没有办法只下载什么显示?我的意思是在过滤条目和/或隐藏列后,是否可以仅下载数据结果?

Is there a way to only download what is shown? What I mean by this is after filtering entries and/or hiding columns, is it possible to download that data result only?

推荐答案

是的,查看ajax按钮 mColumns 选项:

Yes, look at ajax buttons mColumns option :


此参数定义应将哪些列用作数据
源出口。该参数可以是一个
值为'all','visible'或'hidden'的字符串,也可以是要导出的列索引为
的整数数组。

This parameters defines which columns should be used as the data source for the export. The parameter can either be a string with a value of 'all', 'visible' or 'hidden' - or an array of integers with the column indexes to be exported.

此默认值为 all 。在选项中,定义CSV下载按钮,如下所示:

This default value is all. In the options, define the CSV download button like this :

...
oTableTools: {
    sSwfPath: "path-to-your/copy_csv_xls_pdf.swf",
    aButtons: [
        { sExtends : "csv",
          mColumns : "visible"
        }
    ]
}
...

这篇关于数据表 - 是否可以仅下载显示为CSV的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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