How to set name of column visible when export excel plugin tabletool ?
How to set name of column visible when export excel plugin tabletool ?
headshot9x
Posts: 59Questions: 16Answers: 1
Hello guys. I try use tabletool export to excel. In my table have four column : Name, Birthday, Age, Salary. (column Age and Salary is visible). Ok , i want export to excel with name header of column, but i don't know .Please give me some advice.
<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]
}
]
}
The result in file excel as
Name
Green 20 20.000
Blue 15 15.000
Red 10 10.000
Not see name header of column 2 & 3 . Can i set them with define name ? .
Thank guys.
This discussion has been closed.
Answers
Do you mean "not visible"? That's what your "aoColumns" says.
You have no "Age" and "Salary" column headings in your HTML.
Oh, I'm so sory . the solution is using
"sTitle": "Name_Of_Column",