【发布时间】:2015-06-06 08:03:24
【问题描述】:
我尝试使用 tabletool 导出到 excel。在我的表中有四列:姓名、生日、年龄、薪水。 (年龄和工资列可见)。好的,我想用列的名称标题导出到excel,但我不知道。请给我一些建议。
<table id="div_table" class="display cell-border compact" style="width: 100%">
<thead>
<tr>
<td>Name</td>
<td>Birthday</td>
</tr>
</thead>
</table>
"aoColumns": [
{ "mData": "NAME", "aTargets": [0], "sType": "string" },
{ "mData": "BIRTHDAY", "aTargets": [1], "sType": "string" },
{ "mData": "AGE", "aTargets": [2], "sType": "string", "bVisible": false, "bSearchable": false, "orderable": false },
{ "mData": "SALARY", "aTargets": [3], "sType": "string", "bVisible": false, "bSearchable": false, "orderable": false }
],
"tableTools": {
"aButtons": [
{
"sExtends": "xls",
"mColumns": [0, 2, 3]
}
]
}
excel文件中的结果为
Name
Green 20 20.000
Blue 15 15.000
Red 10 10.000
看不到第 2 列和第 3 列的名称标题。我可以用定义名称设置它们吗? .谢谢各位。
【问题讨论】:
-
Excel 导出代码的哪一部分?该代码显示 HTML 和 HTML 下方的内容。那是什么?你希望它做什么?
-
请阅读上面的代码。
标签: jquery excel jquery-datatables