在浏览器中查看的数据表中,我们显示 n 列。当用户点击生成 excel(使用 TableTools 实现)时,我想隐藏一些不需要的列。
如何在运行时隐藏列?
在浏览器中查看的数据表中,我们显示 n 列。当用户点击生成 excel(使用 TableTools 实现)时,我想隐藏一些不需要的列。
如何在运行时隐藏列?
希望这会有所帮助
$(document).ready( function () {
$('#example').dataTable( {
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"aButtons": [
{
"sExtends": "csv",
"sButtonText": "Special columns",
"mColumns": [ 0, 1, 4 ]
},
{
"sExtends": "csv",
"sButtonText": "Visible columns",
"mColumns": "visible"
}
]
}
} );
} );
检查此链接 http://datatables.net/extras/tabletools/button_options#collection_options
查看Allan 发布的 Table Tools 2。我相信它有一个 mColumns 属性,可让您指定单击导出时可以看到哪些列。